Skip to content

Commit

Permalink
feat(examples): bump picoserve to 0.12.x (#433)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspar030 committed Sep 19, 2024
2 parents 6230b2d + 156807a commit ffa1234
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 18 deletions.
17 changes: 14 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/embassy-http-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ embassy-time = { workspace = true, default-features = false }
embedded-io-async = { version = "0.6.0", features = ["defmt-03"] }
heapless = { workspace = true }
httparse = { version = "1.8.0", default-features = false }
picoserve = { version = "0.8.0", default-features = false, features = [
picoserve = { version = "0.12.0", default-features = false, features = [
"embassy",
] }
riot-rs = { path = "../../src/riot-rs", features = ["override-network-config"] }
Expand Down
10 changes: 8 additions & 2 deletions examples/embassy-http-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl picoserve::extract::FromRef<AppState> for ButtonInputs {
}

mod approuter {
use picoserve::routing::get;
use picoserve::routing::{get, get_service};

use crate::routes;

Expand All @@ -51,7 +51,13 @@ mod approuter {
pub type AppRouter = impl picoserve::routing::PathRouter<AppState>;

pub fn make_app() -> picoserve::Router<AppRouter, AppState> {
let router = picoserve::Router::new().route("/", get(routes::index));
let router = picoserve::Router::new().route(
"/",
get_service(picoserve::response::File::html(include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/static/index.html",
)))),
);
#[cfg(feature = "button-readings")]
let router = router.route("/buttons", get(routes::buttons));
router
Expand Down
8 changes: 0 additions & 8 deletions examples/embassy-http-server/src/routes/index.rs

This file was deleted.

4 changes: 0 additions & 4 deletions examples/embassy-http-server/src/routes/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
pub mod index;

#[cfg(feature = "button-readings")]
pub mod buttons;

pub use index::index;

#[cfg(feature = "button-readings")]
pub use buttons::buttons;

0 comments on commit ffa1234

Please sign in to comment.