1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-22 13:29:21 +00:00

Simplify routes definition

This commit is contained in:
Pierre HUBERT 2020-05-21 15:39:20 +02:00
parent 1170a94309
commit 9b7bf77a0a

View File

@ -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))
]
}