koa-lite/examples/streams.js

16 lines
243 B
JavaScript
Raw Normal View History

2013-08-17 07:15:57 +00:00
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);