Created
March 13, 2014 04:02
-
-
Save gjohnson/9521716 to your computer and use it in GitHub Desktop.
Tacking shit onto koa context
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 uuid = require('node-uuid'); | |
var app = koa(); | |
app.use(function *(next) { | |
yield next; | |
this.log('yippie'); | |
this.body = 'yoyoyo'; | |
}); | |
app.use(function *() { | |
this.id = uuid.v4(); | |
this.log = function(msg) { | |
console.log('id=%s, message=%s', this.id, msg); | |
}; | |
}); | |
app.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment