In combination with #11 that introduces a realPath helper for mapping internal routes to published routes, it would be helpful to address the number of places in handlers and templates that construct routes.
Proposal
Add router.nameRoute(name, route) or a name optional parameter to router.route to give a route an internal name.
Add router.routeNamed(name, [params]) and matching template helper.
Usage Example
router.nameRoute("my-detail", "/path/to/:id")
// in handler
res.redirect(router.routeNamed("my-detail", {id: object.id})
// in template
<a href="<%= routeNamed("my-detail", {id: object.id}) %>">
In combination with #11 that introduces a
realPath
helper for mapping internal routes to published routes, it would be helpful to address the number of places in handlers and templates that construct routes.Proposal
Add
router.nameRoute(name, route)
or aname
optional parameter torouter.route
to give a route an internal name. Addrouter.routeNamed(name, [params])
and matching template helper.Usage Example