This commit is contained in:
selfhoster selfhoster 2023-08-18 10:59:50 +02:00
commit c5731665a3
25 changed files with 1110 additions and 0 deletions

24
src/routes/mod.rs Normal file
View file

@ -0,0 +1,24 @@
use axum::{
extract::State,
routing::{get, post},
Router,
};
use crate::state::RoutableAppState;
mod index;
mod login;
/// Build a router for the application, in a specific subpath eg `/yunohost/sso/`
pub fn router(subpath: Option<String>, state: RoutableAppState) -> Router {
let app = Router::new()
.route("/", get(index::route))
.route("/login/", get(login::route))
.with_state(state);
if let Some(p) = subpath {
Router::new()
.nest(&p, app)
} else {
app
}
}