added static assets on webserver

This commit is contained in:
2025-07-30 22:08:36 +02:00
parent 161ebf9bd2
commit fe6540ca3d
4 changed files with 111 additions and 2 deletions

View File

@@ -4,6 +4,8 @@ use embassy_time::Duration;
use picoserve::{AppBuilder, AppRouter, routing::get};
use static_cell::make_static;
mod assets;
pub fn start_webserver(spawner: &mut Spawner, stack: Stack<'static>) {
let app = make_static!(AppProps.build_app());
@@ -23,7 +25,7 @@ impl AppBuilder for AppProps {
type PathRouter = impl picoserve::routing::PathRouter;
fn build_app(self) -> picoserve::Router<Self::PathRouter> {
picoserve::Router::new().route("/", get(|| async move { "Hello World" }))
picoserve::Router::from_service(assets::Assets).route("/api/a", get(async move || "Hello"))
}
}