init
This commit is contained in:
commit
c5731665a3
25 changed files with 1110 additions and 0 deletions
24
src/routes/mod.rs
Normal file
24
src/routes/mod.rs
Normal 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
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue