Back-end Projects: How To Deploy?

Hello fellow campers!

I’m just starting on the back-end projects. So far I’ve done everything through c9’s cloud hosting as recommended. When I get to the ‘get ready for the back-end projects’ sequence, at the end it says to just deploy with c9.

Is doing the projects only on c9 actually okay? From what I can see, you can’t leave c9 running indefinitely / waiting for connections like Heroku can, but I got a little lost trying to connect my app to Heroku myself. I’m fine leaving it on c9, but then no one can actually review it (unless they contact me or something). Or, I guess I could just wait, finish all the projects, and deploy once the guide is ready?

Just looking for some guidance :slight_smile:

Basically you develop on c9, then push your code to github and finally deploy to heroku. Once you have your code on it’s rather easy to get it onto heroku. When you create a new app it gives you the option to link it to your github repository. Do that and then just hit deploy. BTW heroku uses a different port so make sure you set up your port like so:

1 Like

My tip:

Free Code Camp is moving away from recommending c9 and heroku for good reasons (hard to setup, needs credit card, etc.). It is now (or will be very shortly) recommended that you use Gomix (aka HyperDev). I really love it (although I prefer developing locally on Ubuntu Linux over anything…). You don’t have to worry at all about deployment. You just type your code, and it is automatically deployed instantly. You can also export or import to GitHub in just two clicks.

1 Like

Heroku Deployment

  1. In server.js: const port = process.env.PORT || 3000;
  2. In server.js: _app.listen(port);_ 
  3. Create an npm start script such as “start”: “node server.js” - heroku will use npm start to deploy
  4. In the command line: git commit and git push
  5. In the command line: heroku create - generates a url (first time only)
  6. In the command line: git push heroku - builds the application (intalls modules, compresses files)
  7. In the command line: heroku open - opens the page in the browser

Hope that works for you!