Member-only story
A few years ago, if you had a web application, it was difficult to deploy it. Today, the situation is a bit different. There are many good and cheap options to use, and one of them is Heroku. It is straightforward to have your web application deployed and available for free with its easy GitHub integration. To do it, all you need to do is follow the steps described below.
Application
The goal is to have the application served on Heroku. But there are some application setup steps that you need to do first. I am assuming you created your React application using the create-react-app package. That means you already have npm tasks defined. Those include starting an application and building it for production. If you execute the build task, you get a bundled application in the build folder. And that is what you need to serve from the server.
Step 1: ExpressJS setup
For serving files, I am using the ExpressJS server. While there are plenty of other solutions, I like Express for its simplicity. Also, it is straightforward to use it as an API. To install it, execute the following CLI command.