koa-lite/benchmarks/middleware.js
Tejas Manohar ed19e67055 refactor to use ES6 template strings
replace string interp w/ templates in core

use string templating es6 in benchmarks

template strings in tests dir
2015-10-11 21:22:33 -07:00

26 lines
393 B
JavaScript

'use strict';
const http = require('http');
const koa = require('..');
const app = koa();
// number of middleware
const n = parseInt(process.env.MW || '1', 10);
console.log(` ${n} middleware`);
while (n--) {
app.use(function *(next){
yield *next;
});
}
const body = new Buffer('Hello World');
app.use(function *(next){
yield *next;
this.body = body;
});
app.listen(3333);