Code coverage report for koa-jade/example/app.js

Statements: 100% (23 / 23)      Branches: 100% (0 / 0)      Functions: 100% (7 / 7)      Lines: 100% (23 / 23)      Ignored: none     

All files » koa-jade/example/ » app.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 551 1 1 1 1   1                           1   1 11 11     1 5         1 1     1 2     1 1     1 1     1 1     1  
var koa = require('koa')
var Jade = require('..')
var router = require('koa-route')
var path = require('path')
var app = koa()
 
var jade = new Jade({
  viewPath: path.resolve(__dirname, 'views'),
  debug: true,
  helperPath: [
    path.resolve(__dirname, 'helpers'),
    { _: require('lodash') }
  ],
  locals: {
    page_title: 'Koa-jade example',
    author: 'Chris Yip'
  },
  app: app
})
 
jade.locals.github = '//github.com/chrisyip'
 
app.use(function* (next) {
  this.state.repo = 'http://github.com/chrisyip/koa-jade'
  yield next
})
 
app.use(router.get('/', function* () {
  this.render('index.jade', {
    title: 'Koa-jade: a Jade middleware for Koa'
  })
}))
 
app.use(router.get('/home', function* () {
  this.render('home')
}))
 
app.use(router.get('/foo', function* () {
  this.render('foo')
}))
 
app.use(router.get('/foo/index', function* () {
  this.render('foo/index')
}))
 
app.use(router.get('/not-jade', function* () {
  this.render('bar')
}))
 
app.use(router.get('/lodash', function* () {
  this.render('lodash')
}))
 
module.exports = app