When called with http://localhost:3000/foobar
, this works as expected - next()
is called from the first route handler, and we get 'final'
from the second handler:
var express = require('express');
var app = express();
var http = require('http');
app.set('port', 3000);
app.get('/:id', function(req, res, next) {
return next();
});
app.get(/.+/, function(req, res, next) {
res.send('final');
});
http.createServer(app).listen(app.get('port'));
However, similar code in restify doesn't seem to call next()
in the first handler:
var restify = require('restify');
var server = restify.createServer();
server.get('/foobar', function(req, res, next) {
return next();
});
server.get(/.+/, function(req, res, next) {
res.send('final');
});
server.listen(3000, function(req, res) {
console.log('listening on port 3000');
});
My understanding from the routing documentation for restify is that calling next()
will run the next handler in the chain, which matches how express works.
What am I missing, and what am I doing wrong?