Working template, revived JS.
This commit is contained in:
+11
-11
@@ -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(),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user