koa-lite/examples/streams.js
2013-08-17 00:15:57 -07:00

15 lines
243 B
JavaScript

var koa = require('..');
var fs = require('fs');
var app = koa();
// try GET /streams.js
app.use(function(){
return function *(){
var path = __dirname + this.path;
this.body = fs.createReadStream(path);
}
});
app.listen(3000);