How to Deploy MEAN stack to my hosted server? How to Deploy MEAN stack to my hosted server? angularjs angularjs

How to Deploy MEAN stack to my hosted server?


Another good starting point would be Digital Ocean, they offer a one click install MEAN stack, with tutorials. https://www.digitalocean.com/community/tutorials/how-to-use-the-mean-one-click-install-image


I have just deployed my MEAN Stack application on Heroku cloud application environment. The deployment steps are easy.

Steps to deploy:

  1. Your mean stack project structure should be like this. This is very important step. The bottonline is your package.json and server.js should be under your root directory. Have a look at the link to know more about the structure.
  2. Clone your remote repository locally i.e. git clone https://github.com/heroku/node-js-getting-started.git
  3. Go inside the cloned repository e.g. cd node-js-getting-started
  4. Run git add .
  5. Run git commit -m "Sample"
  6. Run Heroku login (It will ask you to press any key and then open up the browser and ask you to click login. After logged in closed the browser instance.
  7. Run heroku create myApp --buildpack heroku/nodejs. Note: Buildpacks are responsible for transforming deployed code into a slug, which can then be executed on a dyno. More information
  8. Run git push heroku master. Your deplyment will start.
  9. Once deployment is done, you will see the complete deployment logs on command prompt terminal
  10. The application is now deployed. Ensure that at least one instance of the app is running: heroku ps:scale web=1

  11. Run heroku open. It will run your deployed instance.

  12. Run heroku logs to view information about your running app. More information

You can find more details visiting following links:

https://devcenter.heroku.com/articles/getting-started-with-nodejs#prepare-the-apphttps://devcenter.heroku.com/articles/deploying-nodejs