An Introduction to Heroku

An OSD600 Exercise


This week, the class was introduced to Heroku, which is described as, “a platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud”. It was a first step for many of us into PaaS concepts, along with interact with such a concept. Luckily, Heroku which is a paid service, can be used  freely to open source projects such as our tutorial. Below, I’ve included Dave’s instructions which guided us through the process, along with any thoughts I had along the way before concluding with a link to my “healthcheck” function, and my repository which houses all the code. Without further delay, let’s begin.


Express Framework

The first item, was installing the Express web framework, which allows for flexible Node.js web applications which are both minimal, and robust. To install, we followed the standard command

, which added the express dependency to the project.

Writing The Server Code

Provided with the code below, the server would utilize Express’s routing for REST API calls. I found this routing to be easy to understand, mirroring how Laravel handles API routing. My only complaint with the code below, which I sure has an answer for that I have yet to discover, is the lack of organization. All the API routings are displayed in the single file, which in this case is easy to read, but what of bigger projects?

Running the server locally requires the following command:

. If all is successful, you can access the server through http://localhost:3000/, and test your previously implemented functions through ~/validate and ~/format. If working, the server will return a JSON response.

Deploying to Heroku

After creating an account on Heroku, the next step would involve installing the Heroku CLI -which is supported on Windows, MacOS, Debian / Ubuntu with native installers, and a standalone which I used on both of my Linux distributions (Fedora, Arch). Once installed, we’d login with

, providing the credentials created previously. The next step for this item would be creating the Procfile, which describes to Heroku which command to run when running the application.

Finally, we deploy to Heroku itself. This is done by first running

in your terminal, which provides you with a random name for the application which is also the application. Pushing to both Github and Heroku is simple, as the previous command added your application’s Heroku repository, and requires only this command after adding and committing your respective files:


Launching the API

To launch the application we just deployed to Heroku, we use the following command

, followed by

if you wish to visit your application’s domain in the browser. My REST API for this tutorial can be found at this link.


This was my first introduction to utilizing a PaaS both in an open source context, and a developers. Every week, It seems that I’m introduced into another universe, driven by technologies and platforms, names and languages; all of which I had never heard before. Last week I learned of TravisCI, and this week’s introduction to Heroku only expands upon an already interesting set of topics which are beyond the reach of the standard curriculum. Curiosity demands my exploration of Heroku, and perhaps for future endeavors into REST APIs will be powered by the platform. Only time will tell.

Leave a Reply

Your email address will not be published. Required fields are marked *