Skip to content

Instantly share code, notes, and snippets.

@artcommacode
Created July 30, 2014 13:23
Show Gist options
  • Save artcommacode/3ba23b50be5b65976723 to your computer and use it in GitHub Desktop.
Save artcommacode/3ba23b50be5b65976723 to your computer and use it in GitHub Desktop.
// first
// render is set on this in app.use(), vPath (view path) is set at top of file
// locals sit in `this.locals` and can be easily merged
this.body = yield this.render(vPath + 'index', {users: users})
// second
// render is required at the top of the file with the view path,
// need to pass in `this` to merge `this.locals`
this.body = yield render.call(this, 'index', {users: users})
// third
// merge locals before sending them off to be rendered
this.body = yield render('index', merge({users: users}, this.locals))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment