express: cant set res.locals

I have the following instead of app.locals.use

app.use (req,res,done) ->
  res.locals.flash = '<li>uh oh!</li>';

In my Jade file, I do:

!{flash}

I keep receiving errors saying that flash isn’t defined…

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 18 (15 by maintainers)

Most upvoted comments

make sure that you defined that middleware near the top (anywhere above app.router) so that it’s invoked before the routes, and make sure to call done()