Next-routes: Error: Route "..." already exists

Created on 11 Jul 2017  路  2Comments  路  Source: fridays/next-routes

This technique had been working, installed the latest npm version and it's broken.

routes.add('entity', '/entity/:actor_id/:tab')
routes.add('entity', '/entity/:actor_id')

/node_modules/next-routes/dist/index.js:89
throw new Error('Route "' + name + '" already exists');
^
Error: Route "entity" already exists

Most helpful comment

Sorry! A route name must be unique, but you can do this in one line:

routes.add('entity', '/entity/:actor_id/:tab?') // <- note "?"

All 2 comments

Sorry! A route name must be unique, but you can do this in one line:

routes.add('entity', '/entity/:actor_id/:tab?') // <- note "?"

Oh nice, thank you, missed that syntax.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adekbadek picture adekbadek  路  4Comments

apapacy picture apapacy  路  4Comments

exogenesys picture exogenesys  路  3Comments

baires picture baires  路  6Comments

jesstelford picture jesstelford  路  3Comments