Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Jesse Zelaya
Jesse Zelaya
13,599 Points

How to setup development and production environments for MEAN stack app?

I've been working on MEAN stack apps for a while, but most of the apps I've created have been built in a single development environment. Ideally I would like to build an app the proper way by setting up different environments and deploying the correct one onto Heroku. I'd like to build it the way it would be built in a real-world project. I've tried for ways to accomplish this, but I've had no luck. I'd like to know what's the best way to approach a project and set up environments and basically the best practices for it. I would really appreciate any tips or resources available.

3 Answers

My first instincts would be to use Gulp, Grunt or webpack to create your build folder with your concatenated, and minified files.

Jesse Zelaya
Jesse Zelaya
13,599 Points

Yeah I have used gulp to make a build folder, but I'm still not sure how to set up a dev env and prod env for both the front and back end.

Well your dev env would be based on your local environment and prod env would be up on the server. This is a great cheat sheet https://en.wikipedia.org/wiki/Development,_testing,_acceptance_and_production

Jesse Zelaya
Jesse Zelaya
13,599 Points

Ah ok. So I could accomplish this with gulp by setting env variables for dev and prod and have gulp tasks to build for local dev environment and a prod environment for server on Heroku right?

igsm '
igsm '
10,440 Points

Good question, I am also looking for more info.

Lets assume, I was developing in the local environment. How can actual deploying process be described? Is it copying/transferring new scripts or snippets of code onto server? Are there any specific procedures or tools to do it?