DPS909 Lab 9 – Deploy to Heroku

This lab builds upon the previous lab. For this lab the task was to extend the previous lab’s code to include cloud PaaS deployment.

I needed to create a simple node.js web server and REST API that uses the Seneca module that was created in the previous labs. I than needed to deploy the server to run on the cloud hosting platform Heroku.

My GitHub repository is available here: https://github.com/badrmodoukh/Seneca2017LearningLab

My Heroku app URL is: https://protected-island-21203.herokuapp.com/

Steps I took to complete this lab:

I first created a node.js web server using express. This provided an HTTP based API for calling the Seneca module functions. I named the file server.js. This is the code in the file:

Screen Shot 2017-04-06 at 1.10.03 AM.pngScreen Shot 2017-04-06 at 1.11.31 AM.png

I than tested the server locally by running node server.js.

This enabled me to navigate to the routes I created which are:

After I tested locally and everything seemed to work properly I needed to deploy to Heroku. I install Heroku and was able to interact with it using the command line. I created a Procfile that informs Heroku which command to run when it starts the app.

After creating the Procfile I needed to add, commit, and push the code onto GitHub.

Once the code was on GitHub I than started the process of deploying the app onto Heroku. The commands I used to do this were:

  • heroku create – this creates a new app and generates a random name for the app
  • git push heroku master – this is used to push the code to the heroku remote that was created
  • heroku ps:scale web=1 – this starts one web server with the code I pushed
  • heroku open – this is used to open the app that was deployed to heroku

After doing these steps the app was running on Heroku.


Overall, doing this lab was quite interesting. I never used Heroku before and I found it fun and important learning how to use it. I liked the way Heroku works with Git making it easier to deploy code. I can see now why it is so important to run your code on cloud infrastructure like Heroku to test your work especially REST APIs. I will definitely consider using this in the future.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s