koa-lite/benchmarks/middleware.js
Lee Bousfield 597638ded6 Remove unused http variable
ESLint now runs fine
2016-03-12 17:53:14 -07:00

20 lines
343 B
JavaScript

'use strict';
const Koa = require('..');
const app = new Koa();
// number of middleware
let n = parseInt(process.env.MW || '1', 10);
console.log(` ${n} middleware`);
while (n--) {
app.use((ctx, next) => next());
}
const body = new Buffer('Hello World');
app.use((ctx, next) => next().then(() => ctx.body = body));
app.listen(3333);