Created
September 25, 2017 17:54
-
-
Save dgaubert/abdd49465d25094831db0d938321a375 to your computer and use it in GitHub Desktop.
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
const express = require('express'); | |
const app = express(); | |
const mw1Factory = function () { | |
return function mw1 (req, res, next) { | |
next(); | |
} | |
} | |
const mws = [ | |
mw1Factory(), | |
function mw2 (req, res, next) { | |
next(); | |
} | |
] | |
app.use(mws, function mw3 (req, res, next) { | |
next(); | |
}); | |
app.use(function mw4 (req, res, next) { | |
next(); | |
}); | |
app.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ DEBUG=express:* node test.js
=>
express:router dispatching GET / +5s
express:router query : / +1ms
express:router expressInit : / +1ms
express:router mw1 : / +0ms
express:router mw2 : / +1ms
express:router mw3 : / +0ms
express:router mw4 : / +0ms