Created
March 24, 2014 22:41
-
-
Save soyuka/9750928 to your computer and use it in GitHub Desktop.
Expressjs 4.0.0-rc3 - middlewares + sub router issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process.env.DEBUG = '*' | |
var express = require('express') | |
var app = express() | |
var middleware = function(req, res, next) { | |
console.log('Trying to put a middleware here') | |
next(null) | |
}, | |
middleware_copy = function(req, res, next) { | |
console.log("That won't be showed") | |
next(null) | |
} | |
app.get('/', middleware, function(req, res, next) { | |
res.send(200) | |
}) | |
var sub = express.Router() | |
// sub.route('/test').all(middleware, middleware_copy).get(function(req, res, next) { | |
// res.send(200) | |
// }) | |
// sub.route('/test').get(middleware, function(req, res, next) { | |
// res.send(200) | |
// }) | |
sub.get('/test', middleware, function(req, res, next) { | |
res.send(200) | |
}) | |
app.use('/sub', sub) | |
app.listen(3001) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment