Skip to content

Commit

Permalink
Add test for ctx.state
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisyip committed Jun 17, 2015
1 parent b2fc62b commit 41facd7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions example/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ app.use(jade.middleware({
locals: {
page_title: 'Koa-jade example',
author: 'Chris Yip',
github: '//github.com/chrisyip',
repo: 'http://github.com/chrisyip/koa-jade'
github: '//github.com/chrisyip'
}
}))

Expand All @@ -27,6 +26,11 @@ app.use(function* (next) {
console.info('<--', this.method, this.url, this.res.statusCode, (Date.now() - start) + 'ms')
})

app.use(function* (next) {
this.state.repo = 'http://github.com/chrisyip/koa-jade'
yield next
})

app.use(router())

router.get('/', function* () {
Expand Down

0 comments on commit 41facd7

Please sign in to comment.