diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 57b0256..a9cd722 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +use axum::response::Redirect; use axum::{extract::Request, routing::get, Router, ServiceExt}; use middleware::cache_control::cache_static; use posts::fs_post_repo::FsPostRepo; @@ -41,13 +42,17 @@ async fn main() { info!("initializing router..."); let app = Router::new() .route("/", get(handlers::index_handler)) - .route("/posts", get(handlers::posts_handler)) - .route("/posts/:post_id", get(handlers::post_handler)) + .route("/posts", get(|| async { Redirect::permanent("/blog") })) + .route("/posts/{post_id}", get(handlers::post_redirect)) + .route("/blog", get(handlers::posts_handler)) + .route("/blog/{post_id}", get(handlers::post_handler)) .with_state(posts) .route("/policies", get(handlers::policies_handler)) .route("/brochure", get(handlers::brochure_handler)) .route("/about", get(handlers::about_handler)) .route("/k12", get(handlers::k12_handler)) + .route("/highered", get(handlers::highered_handler)) + .route("/professional", get(handlers::pro_handler)) .with_state(tutors) .nest_service("/assets", ServeDir::new(assets_dir)) .nest_service("/team", ServeDir::new(tutor_dir)) |