update readme middleware style
This commit is contained in:
parent
2d35cdff50
commit
399e2ad255
1 changed files with 8 additions and 13 deletions
11
Readme.md
11
Readme.md
|
@ -42,22 +42,17 @@ var app = koa();
|
|||
|
||||
// logger
|
||||
|
||||
app.use(function(next){
|
||||
return function *(){
|
||||
app.use(function *(next){
|
||||
var start = new Date;
|
||||
yield next;
|
||||
var ms = new Date - start;
|
||||
console.log('%s %s - %s', this.method, this.url, ms);
|
||||
}
|
||||
});
|
||||
|
||||
// response
|
||||
|
||||
app.use(function(next){
|
||||
return function *(){
|
||||
yield next;
|
||||
app.use(function *(){
|
||||
this.body = 'Hello World';
|
||||
}
|
||||
});
|
||||
|
||||
app.listen(3000);
|
||||
|
@ -110,8 +105,8 @@ $ make test
|
|||
## Authors
|
||||
|
||||
- [TJ Holowaychuk](https://github.com/visionmedia)
|
||||
- [Julian Gruber](https://github.com/juliangruber)
|
||||
- [Jonathan Ong](https://github.com/jonathanong)
|
||||
- [Julian Gruber](https://github.com/juliangruber)
|
||||
|
||||
# License
|
||||
|
||||
|
|
Loading…
Reference in a new issue