From 41facd7be252e602a14d736a9e0103a32deef8db Mon Sep 17 00:00:00 2001 From: Chris Yip Date: Wed, 17 Jun 2015 23:39:00 +0800 Subject: [PATCH] Add test for `ctx.state` --- example/app.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/example/app.js b/example/app.js index 21d1876..5f89c3b 100644 --- a/example/app.js +++ b/example/app.js @@ -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' } })) @@ -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* () {