Reputation: 5933
I have two routes that match the URL http://localhost:8080/app/users/find but I don't want the second one to be executed because the first is more specific.
In the example below how can I prevent the 'did not stop' message of being written?
app.get('/app/users/find', function(req, res, next) {
console.log('route 1');
res.end('route 1 return');
next('stop!');
});
app.all('/:controller?/:action?(/|)', function (req, res, next) {
console.log('did not stop');
res.end();
});
next()
- does not worknext(new Error('something'))
- does not workfalse
- does not workUpvotes: 0
Views: 51
Reputation: 5933
There were actually two requests happening. The second one was to /favicon.ico
Upvotes: 0
Reputation: 887195
That's exactly what next()
does.
If you don't want to run the next handler, don't call that.
Upvotes: 2