Last active
August 29, 2015 14:13
-
-
Save kumavis/220699f0fc5d52e2cfc4 to your computer and use it in GitHub Desktop.
Example of es6 transpile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var koa = require('koa'); | |
var app = koa(); | |
// logger | |
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 *(){ | |
this.body = 'Hello World'; | |
}); | |
app.listen(3000); |
Author
kumavis
commented
Jan 21, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment