fix error load html (backend)
This commit is contained in:
@@ -9,7 +9,7 @@ use tower_http::services::ServeDir;
|
|||||||
async fn main() {
|
async fn main() {
|
||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
.route("/", get(handler))
|
.route("/", get(handler))
|
||||||
.nest_service("/assets", ServeDir::new("../web/assets"));
|
.nest_service("../web/assets", ServeDir::new("../web/assets"));
|
||||||
|
|
||||||
let addr = SocketAddr::from(([0, 0, 0, 0], 3500));
|
let addr = SocketAddr::from(([0, 0, 0, 0], 3500));
|
||||||
println!("listening on {}", addr);
|
println!("listening on {}", addr);
|
||||||
@@ -20,7 +20,7 @@ async fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn handler() -> Html<String> {
|
async fn handler() -> Html<String> {
|
||||||
let html_content = read_html_from_file("/web/templates/view/index.html")
|
let html_content = read_html_from_file("../web/templates/view/index.html")
|
||||||
.await
|
.await
|
||||||
.unwrap_or_else(|_| "<h1>Error loading HTML file</h1>".to_string());
|
.unwrap_or_else(|_| "<h1>Error loading HTML file</h1>".to_string());
|
||||||
Html(html_content)
|
Html(html_content)
|
||||||
|
|||||||
Reference in New Issue
Block a user