mpen mpen - 2 months ago 4x
Jade Question

How to get environment inside a view?

I'm using Express with Jade. How can I get the environment from within my view?

In JS, I can get it with

. How do I get it from Jade?


You can put it in as a variable when you render your view, in jade it would look like this

p Environment: #{appEnv}

And in the route that controls that view you should do something like this

res.render("viewName", { 
        appEnv: app.get('env')