Working template, revived JS.

This commit is contained in:
2026-06-13 11:20:18 +01:00
parent 02992f56ec
commit 2c4f4bb90e
2 changed files with 131 additions and 11 deletions
+11 -11
View File
@@ -1,20 +1,20 @@
use axum::{Router, routing::get};
use std::fs;
use axum::{Router, response::Html, routing::get};
#[tokio::main]
async fn main() {
let app = Router::new()
.route(
"/",
get(|| async { "Incorrect reverse-proxy, '/' should be handled elsewhere." }),
)
.route("/fares", get(app));
.route("/", get(|| async { "Incorrect reverse-proxy for '/'." }))
.route("/fares", get(app_content));
let listener = tokio::net::TcpListener::bind("0.0.0.0:8000").await.unwrap();
axum::serve(listener, app).await.unwrap();
}
async fn app() -> String {
let tree = html::text_content::Division::builder()
.text("Hello Fares!")
.build();
tree.to_string()
async fn app_content() -> Html<String> {
Html(
fs::read_to_string("./media/template.html")
.unwrap_or_default()
.to_string(),
)
}