middleware.js
This file
Path
benchmarks/middleware.js
23 lines · 371 bytes · JavaScript
Last changed by
add new benchmarks (to match koa)TJ Holowaychukbefore adoption9a45f7b
History of this fileTake it
add new benchmarks (to match koa)TJ Holowaychukbefore adoption9a45f7b
lines 1–23why, one step back12var http = require('http');3var express = require('..');4var app = express();56// number of middleware78var n = parseInt(process.env.MW || '1', 10);9console.log(' %s middleware', n);1011while (n--) {12 app.use(function(req, res, next){13 next();14 });15}1617var body = new Buffer('Hello World');1819app.use(function(req, res, next){20 res.send(body);21});2223app.listen(3333);