mirror of
https://github.com/supleed2/cch23-8bit.git
synced 2024-12-22 14:05:48 +00:00
Reorganise code by day
This commit is contained in:
parent
a786c6ac4a
commit
769f5cb129
15
src/cal/day00.rs
Normal file
15
src/cal/day00.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
use axum::{http::StatusCode, response::IntoResponse, routing::get, Router};
|
||||
|
||||
pub(crate) fn router() -> Router {
|
||||
Router::new()
|
||||
.route("/", get(hello_world))
|
||||
.route("/-1/error", get(fake_error))
|
||||
}
|
||||
|
||||
async fn hello_world() -> impl IntoResponse {
|
||||
"Hello, world!"
|
||||
}
|
||||
|
||||
async fn fake_error() -> impl IntoResponse {
|
||||
StatusCode::INTERNAL_SERVER_ERROR
|
||||
}
|
6
src/cal/mod.rs
Normal file
6
src/cal/mod.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
mod day00;
|
||||
|
||||
pub(crate) fn router() -> axum::Router {
|
||||
axum::Router::new()
|
||||
.nest("/", day00::router())
|
||||
}
|
16
src/main.rs
16
src/main.rs
|
@ -1,18 +1,6 @@
|
|||
use axum::{http::StatusCode, response::IntoResponse, routing::get, Router};
|
||||
|
||||
async fn hello_world() -> impl IntoResponse {
|
||||
"Hello, world!"
|
||||
}
|
||||
|
||||
async fn fake_error() -> impl IntoResponse {
|
||||
StatusCode::INTERNAL_SERVER_ERROR
|
||||
}
|
||||
mod cal;
|
||||
|
||||
#[shuttle_runtime::main]
|
||||
async fn main() -> shuttle_axum::ShuttleAxum {
|
||||
let router = Router::new()
|
||||
.route("/", get(hello_world))
|
||||
.route("/-1/error", get(fake_error));
|
||||
|
||||
Ok(router.into())
|
||||
Ok(axum::Router::new().nest("/", cal::router()).into())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue