Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Set Node.js Environment Variable (NODE_ENV) in iisnode to Production/Development/Test

Set Node.js Environment Variable (NODE_ENV) in iisnode to Production/Development/Test

Problem

How do we tell iisnode to run our Node.js application environment in production/development/test?

We have successfully gotten our Node.js app running with iisnode but process.env.NODE_ENV is coming out as 'undefined'.

At the moment, our web.config file is written this way:

Problem courtesy of: Jon Saw

Solution

Joachim is right above that adding to web.config allows control over the NODE_ENV value. Another way is to add the iisnode.yml file next to your web.config, and in there spcify the NODE_ENV value as node_env: production. See other settings you can use in iisnode.yml at https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/iisnode.yml

Solution courtesy of: Tomasz Janczuk

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Set Node.js Environment Variable (NODE_ENV) in iisnode to Production/Development/Test

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×