routes - Node.js double routing issue -


i have 2 routes getting hit same url: http://localhost:3000/admin/venues/edit/1234

i expect url trigger route 2. why triggering route 1?

route #1:

app.get('/:locality/:category/:venue', require('../views/details/index').index); 

route #2:

app.get('/admin/venues/edit/:slug', require('../views/admin/index').index)) 

i guess second route can't understand should not trigger on first param being 'admin'. can specify regexp pattern words 'admin' should ignored first param in route #1?

since route 1 placed before route 2, node think "admin" value want assign :locality parameter. switch order of routes , should fine. rule of thumb, place routes parameters @ end of routing list. order matters routes.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -