sumptingeneric / barback

4 stars 11 forks source link

Ready to set up first iteration of automated deployments #41

Closed deduced closed 6 years ago

deduced commented 6 years ago

Also made some changes:

deduced commented 6 years ago

@fredricklou523 these articles are good primers on env variables: https://www.twilio.com/blog/2017/08/working-with-environment-variables-in-node-js.html and https://medium.freecodecamp.org/heres-how-you-can-actually-use-node-environment-variables-8fdf98f53a0a.

The TL;DR is that heroku automatically runs your application setting NODE_ENV to "production" by default which is what we want and the reason that you see the express server have the conditional wrapper for NODE_ENV !== 'production'. I added some scripts to facilitate local development and for production (heroku by default uses npm start). Other than that, the articles I posted teach you about environment variables and how to use them (using dotenv package for example).

Hope that helps.