mpen mpen - 1 year ago 70
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?

Answer Source

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')