Merge pull request #546 from stojanovic/master

Update docs - add template strings and arrow functions where applicable
This commit is contained in:
Julian Gruber 2015-10-24 14:18:08 +02:00
commit c86e3faeb1
2 changed files with 5 additions and 7 deletions

View file

@ -64,7 +64,7 @@ app.use(function *(next){
const start = new Date;
yield next;
const ms = new Date - start;
this.set('X-Response-Time', ms + 'ms');
this.set('X-Response-Time', `${ms}ms`);
});
// logger
@ -73,7 +73,7 @@ app.use(function *(next){
const start = new Date;
yield next;
const ms = new Date - start;
console.log('%s %s - %s', this.method, this.url, ms);
console.log(`${this.method} ${this.url} - ${ms}`);
});
// response

View file

@ -17,7 +17,7 @@ function *responseTime(next) {
const start = new Date;
yield next;
const ms = new Date - start;
this.set('X-Response-Time', ms + 'ms');
this.set('X-Response-Time', `${ms}ms`);
}
app.use(responseTime);
@ -30,7 +30,7 @@ app.use(function *(next){
const start = new Date;
yield next;
const ms = new Date - start;
this.set('X-Response-Time', ms + 'ms');
this.set('X-Response-Time', `${ms}ms`);
});
```
@ -223,9 +223,7 @@ const fs = require('co-fs');
app.use(function *(){
const paths = yield fs.readdir('docs');
const files = yield paths.map(function(path){
return fs.readFile('docs/' + path, 'utf8');
});
const files = yield paths.map(path => fs.readFile(`docs/${path}`, 'utf8'));
this.type = 'markdown';
this.body = files.join('');