Open In App

How to Deploy Node.js Express Application on Render ?

Last Updated : 15 May, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

When it comes to hosting Node.js applications, there are many options available, ranging from shared hosting to dedicated servers and cloud platforms. Some popular hosting providers that support Node.js include Heroku, Amazon Web Services (AWS), Microsoft Azure, DigitalOcean, and Google Cloud Platform (GCP). When choosing a hosting provider, it’s important to consider factors such as cost, reliability, scalability, security, and support. It’s also worth exploring the different deployment options available, such as using a Docker container or a platform-specific deployment tool like PM2.

But we will deploy on the render because it gives the free small part of CPU and RAM. If you created a website like a portfolio website and want to host it, then Render going to be a good choice for you. Render is easy to use and no management is required after deployment of the website. It is manageable by the server provider. Render gives you to use its free server of  500 MB RAM and 0.1 CPU. You can also host the backend server of your website on the render.

In this article, we will see how to deploy the Node.js and Express.js application on render.

 

What is Render? 

Render is the website that provides hosting services. Render is a cloud-based platform that provides a simple and scalable way to host and manage websites and web applications. With Render, users can quickly deploy websites and applications to the cloud, without having to worry about infrastructure management or server maintenance. It provides the free service to host up to the

Step-by-Step Implementation:

Step 1:  Deploy the code on GitHub: You need to deploy the code on GitHub first. To deploy the code on GitHub you can refer to How to upload project on github.

Step 2: Now create the account on Render. You can Sign in with GitHub.

Step 3: On the Dashboard, click on the new and then web service as shown in the below image.

 

Step 4: Next configure the GitHub repository that originally have your project. By clicking on the Configure account as shown in the below image. After configuring click on the connect button.

 

Step 5: Now you are on the screen “You are deploying a web service”,  After Type the name of the project as shown in the below image “My Nodejs App”. and remain will be the same.

 

Step 6:  Next,  this is the main part, in Start Command, you have to write the Start Command for your app that going to be exactly the same as in the packages Json file scripts. And then click on free and as you want but we are going with free.

 

 My Package Json file looks like and sees the start scripts that is node server.js.

Javascript




{
    "name": "sample",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "type": "module",
    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1",
        "start": "node server.js"
    },
    "author": "",
    "license": "ISC",
    "dependencies": {
          "express": "^4.18.2"
    }
}


Step 7: If your Node.js application has the environment variables then add all of them by clicking on advance and then Add Environment Variable.

 

Step 8: Next Click on Create and wait for a moment until it is deployed.

 

Now finally your Node.js app is deployed on render, you can check it by clicking on the link, that appears something like that.

 

Output: 

 



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads