koa-lite/examples/streams.js

14 lines
214 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 *(){
var path = __dirname + this.path;
this.body = fs.createReadStream(path);
2013-08-17 07:15:57 +00:00
});
app.listen(3000);