Today I am going to use Heroku. Heroku is a clod hosting platform.
Create a node.js Web Server
First, I am going to install Express using npm:
After creating server.js file and running it with the following command:
I got the following:
Now, after we tested our server.js and made sure that it works, we can move on to the next part.
Deploy to Heroku
Step 1 – Create your account
In order to create an account we should go here.
Step 2 – Download the Heroku CLI
After installing Heroku, you can login with your credentials:
Step 3 – Create Heroku App Settings Files
Next step is to create a Procfile which is going to look like this:
Step 4 – Deploy the App
First, I am going to create a new app using Heroku CLI:
After this, we need to make sure we added all of the files and committed them. Now we can push our code to Heroku.
By doing all the above we just deployed the our code to Heroku. Now we need to start the app.
heroku ps:scale web=1 heroku open
I found this lab really interesting and knowledgeable. Like all labs that I have completed in OSD600. I deployed an app!!! I learned how to create a node.js web server and what is Heroku and how to use it.