Make index page redirect to rather than duplicate crates page

This commit is contained in:
Nico Burns 2022-05-02 13:12:15 +01:00
parent 7a4b12dd7f
commit caf1a1263b

View file

@ -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)