2
如果我有两条路径,比如说/path/one
和path/two
,我不是都是先由父处理程序处理,然后由它们的特定处理程序处理。我怎样才能实现它。下面的代码将不起作用。他们的具体处理程序从不运行node-restify父路径处理程序
const restify = require('restify');
const app = restify.createServer();
app.get('/path/:type', function (req, res, next) {
console.log(req.params.type + ' handled by parent handler');
next();
});
app.get('/path/one', function (req, res) {
console.log('one handler');
res.end();
});
app.get('/path/two', function (req, res) {
console.log('two handler');
res.end();
});
app.listen(80, function() {
console.log('Server running');
});