workday ending

This commit is contained in:
Philipp
2025-04-16 20:04:55 +02:00
parent d18b967f39
commit 880e8f24a7
4 changed files with 37 additions and 16 deletions

View File

@@ -1,20 +1,29 @@
use rocket::Config;
use rocket::{get, http::ContentType, response::content::RawHtml, routes};
use rust_embed::Embed;
use std::borrow::Cow;
use std::ffi::OsStr;
#[derive(Embed)]
#[folder = "web/dist"]
struct Asset;
pub async fn start_webserver() -> Result<(), rocket::Error> {
rocket::build()
let config = Config {
address: "0.0.0.0".parse().unwrap(), // Listen on all interfaces
port: 8000,
..Config::default()
};
rocket::custom(config)
.mount("/", routes![static_files,index])
.launch()
.await?;
Ok(())
}
#[get("/")]
fn index() -> Option<RawHtml<Cow<'static, [u8]>>> {
let asset = Asset::get("index.html")?;