Use URL parameter [wip]

This commit is contained in:
finga 2022-09-20 16:45:01 +02:00
parent 6aa9bb0e43
commit 0e73d062b5
2 changed files with 12 additions and 3 deletions

View file

@ -12,10 +12,12 @@ use wasm_bindgen_futures::spawn_local;
use yew::prelude::*;
use yew_router::prelude::*;
#[derive(Clone, Debug, Eq, PartialEq, Routable)]
#[derive(Routable, PartialEq, Eq, Clone, Debug)]
pub enum Route {
#[at("/")]
LockWatch,
// #[at("/")]
// LockWatch,
#[at("/:id")]
LockWatch { id: u64 },
#[not_found]
#[at("/404")]
NotFound,

View file

@ -128,6 +128,13 @@ async fn main() -> Result<()> {
))
.handle_error(file_error),
)
.route(
"/:clock_id",
get_service(ServeFile::new(
&PathBuf::from(&cli.static_dir).join("index.html"),
))
.handle_error(file_error),
)
.layer(ServiceBuilder::new().layer(TraceLayer::new_for_http()));
let addr = SocketAddr::from((cli.address, cli.port));