utils
: Allow zero templates and routes
This commit is contained in:
parent
72f12b6de7
commit
e2687011eb
1 changed files with 4 additions and 4 deletions
|
@ -29,10 +29,10 @@ macro_rules! web_server {
|
|||
(
|
||||
on: $socket_addr:expr,
|
||||
templates: [
|
||||
$( $template_path:literal ),+
|
||||
$( $template_path:literal ),*
|
||||
],
|
||||
routes: {
|
||||
$( $path:literal => $route:expr ),+
|
||||
$( $path:literal => $route:expr ),*
|
||||
}
|
||||
) => {
|
||||
$crate::init::init_logging();
|
||||
|
@ -40,11 +40,11 @@ macro_rules! web_server {
|
|||
let mut mj = $crate::init::init_minijinja();
|
||||
$(
|
||||
$crate::add_minijinja_template!(mj, $template_path);
|
||||
)+
|
||||
)*
|
||||
let router = $crate::init::init_router(mj);
|
||||
$(
|
||||
$crate::add_axum_route!(router, $path, $route);
|
||||
)+
|
||||
)*
|
||||
$crate::run::run_server(listener, router).await
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue