Create static file endpoints

This commit is contained in:
Nettika 2026-01-25 14:37:39 -08:00
parent ac64fd8ebe
commit 64e810d360
No known key found for this signature in database
2 changed files with 16 additions and 4 deletions

View file

@ -1,10 +1,22 @@
mod project;
use rouille::router;
mod db;
mod project;
fn main() {
println!("Starting server on localhost:8080");
rouille::start_server("localhost:8080", move |_request| {
rouille::Response::empty_404()
rouille::start_server("localhost:8080", move |request| {
router!(request,
(GET) ["/main.css"] => {
let css = include_bytes!("main.css");
rouille::Response::from_data("text/css", css.as_ref())
},
(GET) ["/project-card.js"] => {
let js = include_bytes!("project-card.js");
rouille::Response::from_data("application/javascript", js.as_ref())
},
_ => rouille::Response::empty_404()
)
});
}