I use Sails.js with default template engine (EJS). I have a view defined directly from routes config:
config/routes.js
'/': {
view: 'homepage'
}
Is there a way to access environment in homepage.ejs? I need something like this:
views/homepage.ejs(next does not work, so I need a working solution)
...
<span>Hello you are on <%= sails.env %> environment</span>
...
to be rendered as:
Hello you are on production environment
Please do not suggest me to create controller for this.
I hope there is the way to get it either directly from view or through a locals in route, but how, that is the question.
try this
<%= sails.config.environment %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With