Cleanup code
This commit is contained in:
parent
66da2274a7
commit
208cfe3608
1 changed files with 31 additions and 29 deletions
12
src/main.rs
12
src/main.rs
|
|
@ -20,7 +20,13 @@ fn main() {
|
||||||
let js = include_bytes!("project-card.js");
|
let js = include_bytes!("project-card.js");
|
||||||
rouille::Response::from_data("application/javascript", js.as_ref())
|
rouille::Response::from_data("application/javascript", js.as_ref())
|
||||||
},
|
},
|
||||||
(GET) ["/projects"] => {
|
(GET) ["/projects"] => display_projects(),
|
||||||
|
_ => rouille::Response::empty_404()
|
||||||
|
)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fn display_projects() -> rouille::Response {
|
||||||
let projects = db::list_all_projects().unwrap_or_default();
|
let projects = db::list_all_projects().unwrap_or_default();
|
||||||
|
|
||||||
let markup = html! {
|
let markup = html! {
|
||||||
|
|
@ -48,8 +54,4 @@ fn main() {
|
||||||
};
|
};
|
||||||
|
|
||||||
rouille::Response::html(markup.into_string())
|
rouille::Response::html(markup.into_string())
|
||||||
},
|
|
||||||
_ => rouille::Response::empty_404()
|
|
||||||
)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue