feat: Rewrite routes, pages and components to be more HATEOAS

This commit is contained in:
2024-08-23 18:45:43 +02:00
committed by florian_briand
parent 7487b34a17
commit 8ce18e53d5
13 changed files with 201 additions and 57 deletions

View File

@ -4,6 +4,9 @@ use askama_axum::Template;
use axum::http::{StatusCode, Uri};
use tower_http::services::ServeDir;
mod menu;
mod pages;
async fn fallback(uri: Uri) -> (StatusCode, String) {
(StatusCode::NOT_FOUND, format!("No route for {uri}"))
}
@ -20,7 +23,6 @@ pub fn get_router(assets_path: &Path) -> axum::Router {
axum::Router::new()
.nest_service("/assets", ServeDir::new(assets_path))
.route("/", axum::routing::get(root))
// .nest("/pages", old_pages::get_routes())
// .merge(old_templates::get_routes())
.merge(pages::get_routes())
.fallback(fallback)
}