mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-26 07:19:22 +00:00
Simplify routes definition
This commit is contained in:
parent
1170a94309
commit
9b7bf77a0a
@ -32,10 +32,22 @@ pub struct Route {
|
||||
pub func: RequestProcess,
|
||||
}
|
||||
|
||||
impl Route {
|
||||
|
||||
pub fn get_without_login(uri: &'static str, func: RequestProcess) -> Route {
|
||||
Route {
|
||||
method: GET,
|
||||
need_login: false,
|
||||
uri,
|
||||
func
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the list of routes available
|
||||
pub fn get_routes() -> Vec<Route> {
|
||||
vec![
|
||||
// Server meta routes
|
||||
Route { method: GET, uri: "/", need_login: false, func: Box::new(server_controller::main_index) }
|
||||
Route::get_without_login("/", Box::new(server_controller::main_index))
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user