Dynamic routes with 'fixed ends' (iron:router)


#1

How do you make a dynamic route based on parts of an existing one?

Like /services/:service/configure, where :service is a slug and the rest is fixed. So when at /services/serviceA/, a ‘configure’ link points to /services/serviceA/configure/, etc.

Solved (if you have suggestions for improvement):

  @.route 'service_configure'
    path: '/services/:service?/configure'
<a href="{{pathFor 'service_configure' service=service }}">Configure</a>
service: () ->
  Session.get "service"