Simplify url route: to '/:_id' instead of '/lists/:_id

I’m using the official Todos app as a means to learn Meteor and apply similar principles to my own project.

I want to simplify a list’s url by removing the “/lists” part from the path: i.e. rather than

I’d like the url to my list to be:

I originally thought this was easy: in routes.js I’d simply change:

FlowRouter.route('/lists/:_id', {

to

FlowRouter.route('/:_id', {

…and it all seemed to work fine at first… until I tried navigating to /signin or /join.

It appears that FlowRouter is clashing with AccountsTemplates in useraccounts-configuration.js - in this configuration the system doesn’t know that /signin isn’t just another list.

In terms of best practise, what is the best way to resolve this?

It’s reading your routes top to bottom, so put :_id route at the very end or go back to your /lists version.

1 Like

That actually worked! thank you