Create, Deploy, and Test the REST API on Heroku
Learn to create, deploy, and test a REST API on Heroku.
We'll cover the following
Note: Before we begin this lesson, kindly check the appendix for detailed instructions on installing and setting up Heroku on your machine.
What is Heroku?
Heroku as a service is a cloud platform that enables software developers and organizations to build, manage, scale, and deploy modern applications. Heroku has been around since 2007, and it supports various programming languages like Ruby, Python, Node.js, PHP, Go, Java, Scala, and Clojure.
Heroku has various products, including Heroku Platform, Heroku Postgres, Heroku Redis, Heroku Enterprise, Heroku Teams, Heroku Connect, Heroku Elements, Heroku Review Apps, and Apache Kafka on Heroku. We’ll use the Heroku Platform in this course.
There are various alternatives to Heroku that we could have used, including Firebase, Digital Ocean, Google App Engine, Netlify, AWS, etc. Aside from the fact that we have access to a free tier plan with Heroku, let’s look at some of its other merits.
Merits of Heroku
Heroku supports multiple programming languages. It’s easy to use and allows developers to focus more on development. It allows the integration of add-ons and third-party services and supports the command-line interface. Heroku also provides robust security support for developers. It is used to build modern, scalable applications. Heroku is not a perfect platform, and it has its limitations, which are listed below.
Drawbacks of Heroku
Heroku pricing is relatively more expensive than other cloud services like AWS. Heroku also has a limited number of options for selecting a region and is only available in the United States and Europe, leading to lapses for applications hosted outside of these regions. Dynos, which power Heroku applications, are prone to sleeping by default if no traffic occurs within a short period. Sleeping applications can have a slight impact on performance.
Creating a new Heroku project
To create a new Heroku project, all we need to do is log in to Heroku, and on the top right-hand side of the page, we’ll see a button that has the text “New.” Once we click on this button, a dropdown will show two options. We then go ahead and select “Create new app,” which will take us to the page where we’ll have to fill in some details like the application name and region, as seen below:
Get hands-on with 1400+ tech skills courses.