From caf1a1263b5626d9aee65b59a2370cd16630efce Mon Sep 17 00:00:00 2001 From: Nico Burns Date: Mon, 2 May 2022 13:12:15 +0100 Subject: [PATCH] Make index page redirect to rather than duplicate crates page --- src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index caef5c9..cd5ce45 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,7 @@ use axum::{ routing::{get, post, get_service}, Router, http::StatusCode, + response::Redirect, }; use std::net::{SocketAddr, IpAddr}; use tower_http::{services::ServeDir, trace::TraceLayer}; @@ -21,7 +22,7 @@ async fn main() { // build our application with a route let app = Router::new() - .route("/", get(routes::crates::list::run)) + .route("/", get(|| async { Redirect::to("/crates") })) .route("/users", post(routes::users::create::run)) .route("/crates", get(routes::crates::list::run)) .nest("/static", static_file_service)