Expand description
Filesystem-based routing for Yew.
Simply create a src/pages/ folder and place rust source files inside it at the desired path.
Each source file must expose a component called Page that will be rendered at that path.
URL parameters will be passed automatically as props.
Some examples:
pages/index.rswill be served at/pages/foo.rswill be served at/foopages/blog/index.rswill be served at/blogpages/blog/[id].rswill be served at/blog/<any string>and the page component will receive anidprop of typeString.pages/blog/[id:u64].rswill be served at/blog/<any u64>and the page component will receive anidprop of typeu64.
Typed parameters work with anything that implements FromStr. If the conversion fails, the route will not match.
TODO:
- Implement not found handling.
Macros§
- router
- Use in the root of your crate in order to include all the modules and generate the router.
Structs§
Functions§
- change_
detection - Call in
build.rs. Needed to make proper change detection work when a new page is created.