Launching an Express application on Heroku

Madeline Celis
Sep 4, 2018 · 3 min read

A few months ago, I followed the MDN tutorial to learn how to use the Express framework. I completed the project but never launched it on Heroku. So that’s what I set out to do today. The first thing I did was make a Github repository. I cloned the repo onto my computer and once I had my repo cloned I opened the package.json and included the following:

At this point, I went back and checked to see if my application was still working. So I went to my terminal and typed in

DEBUG=MDN-Library-Tutorial:* npm start (this will only work if you are on a mac)

and went to localhost:3000/catalog to see if everything was still working (and thankfully it was!).

Since everything was working, I went ahead and typed on my terminal:
1. git add . (to save all my files)
2. git commit -m ‘application is working and ready to go into production’
3. git push origin master (the terminal prompts the user to enter GitHub password)

I was now ready to log in to Heroku. I needed to install the Heroku client so there were two options. I could either homebrew it or just download it. I tried homebrewing but my Xcode version needed to be updated so I ended up downloading it instead.

Once my Heroku client was installed, I typed, ‘heroku login’ on my terminal.

To officially launch the website there are three commands you need to run on your terminal.
1. Type ‘heroku create’ (to make a git remote your application called heroku) 2. Type ‘git push heroku master’ (this line uploads your whole application onto Heroku and start your site).
3. Type ‘heroku open’

That’s it you’ve officially launched your site!!!

I went ahead and set up my environment from development to production at this point and set up Heroku to use my MongoDB URI. If you would like to see the full MDN Tutorial visit: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs and if you would like to see my final tutorial app visit: https://tranquil-sea-38534.herokuapp.com/catalog

Written by

Full Stack Web Developer

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade