Use URL parameter [wip]
This commit is contained in:
parent
6aa9bb0e43
commit
0e73d062b5
|
@ -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,
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue