added nested routes, added separate config struct, among other items
This commit is contained in:
@ -1,15 +1,23 @@
|
||||
use axum::{
|
||||
http::StatusCode,
|
||||
response::{Html, IntoResponse},
|
||||
routing::get,
|
||||
Router,
|
||||
};
|
||||
|
||||
pub struct RootRoute;
|
||||
impl RootRoute {
|
||||
pub async fn root() -> Html<&'static str> {
|
||||
pub fn routes() -> Router {
|
||||
Router::new()
|
||||
.route("/", get(RootRoute::root))
|
||||
.fallback(RootRoute::not_found)
|
||||
}
|
||||
|
||||
async fn root() -> Html<&'static str> {
|
||||
Html("<p>Copyright Wyatt J. Miller 2024</p>")
|
||||
}
|
||||
|
||||
pub async fn not_found() -> impl IntoResponse {
|
||||
async fn not_found() -> impl IntoResponse {
|
||||
(StatusCode::NOT_FOUND, "¯\\_(ツ)_/¯")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user