2013-09-03 02:28:54 +00:00
|
|
|
|
|
|
|
var koa = require('..');
|
|
|
|
var fs = require('co-fs');
|
|
|
|
var app = koa();
|
|
|
|
|
|
|
|
// read docs/*.md in parallel
|
|
|
|
// and return a joined response
|
|
|
|
|
2013-11-08 09:13:43 +00:00
|
|
|
app.use(function *(){
|
|
|
|
var paths = yield fs.readdir('docs');
|
2013-09-03 02:28:54 +00:00
|
|
|
|
2013-11-08 09:13:43 +00:00
|
|
|
var files = yield paths.map(function(path){
|
|
|
|
return fs.readFile('docs/' + path, 'utf8');
|
|
|
|
});
|
2013-09-03 02:28:54 +00:00
|
|
|
|
2013-11-08 09:13:43 +00:00
|
|
|
this.type = 'markdown';
|
|
|
|
this.body = files.join('');
|
2013-09-03 02:28:54 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
app.listen(3000);
|