A good router should:
Check out our (website)[https://www.goodrouter.org], join our (Discord server)[https://discord.gg/BJ8v7xTq8d]!
```rust let mut router = Router::new();
router.insertroute("all-products", "/product/all"); router.insertroute("product-detail", "/product/{id}");
// And now we can parse routes!
{ let route = router.parseroute("/not-found"); asserteq!(route, None); }
{ let route = router.parseroute("/product/all"); asserteq!(route, Some(Route{ name: "all-products".to_owned(), parameters: vec![], })); }
{ let route = router.parseroute("/product/1"); asserteq!(route, Some(Route{ name: "product-detail".to_owned(), parameters: vec![ ("id", "1"), ], })); }
// And we can stringify routes
{ let path = router.stringifyroute(Route{ name: "all-products".toowned(), parameters: vec![], }); asserteq!(path, "/product/all".toowned(),); }
{ let path = router.stringifyroute(Route{ name: "product-detail".toowned(), parameters: vec![ ("id", "1"), ], }); asserteq!(path, "/product/2".toowned()); } ```