my-website-v2/backend/public/src/routes/root.rs

24 lines
505 B
Rust
Raw Normal View History

use axum::{
http::StatusCode,
response::{Html, IntoResponse},
routing::get,
Router,
};
pub struct RootRoute;
impl RootRoute {
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>")
}
async fn not_found() -> impl IntoResponse {
(StatusCode::NOT_FOUND, "¯\\_(ツ)_/¯")
}
}