There's a table with a list of user on an html page. How can I generate a link to a page where I show an information about a single user? "/users/:user_name" ?
I can hard-code it, of course. But I want to be safer by generating with help of Iron.
Iron's router has two macros that work together.
router! allows you to define routes with a key:
router!
let router = router!(index: get "/" => index, query: get "/:query" => queryHandler, post: post "/" => postHandler);
url_for! allows you to generate a URL for a key:
url_for!
url_for!(request, "foo", "query" => "test", "extraparam" => "foo")
Iron's router has two macros that work together.
router!
allows you to define routes with a key:url_for!
allows you to generate a URL for a key: