Free tiers are particularly handy and cost-effective if you intend to deploy and host applications for a short period.
What Is Render?
But how does it compare to popular cloud solutions like Heroku?
This guide will make use of its web services feature to deploy an Express.js REST API.
To follow along, you will need to first set up a PostgreSQL database instance on Render.
On the overview page, punch theNew PostgreSQLbutton to set up a new instance.
Next, fill in the name of your database, and click onCreate database.
Finally, copy theInternal Database URLprovided.
You will use it to configure the connection between your Express REST API and the PostgreSQL database.
Create an Express.js REST API
Go ahead andcreate an Express.js web server.
Next, open theindex.jsfile, and add the code below thatimplements a simple REST APIwith four routes.
Finally, add these commands to yourpackage.jsonfile.
Next, log into your Render account, choose theNew+button, and select theWeb Serviceoption from the drop-down menu.
Finally, access your GitHub account, select your project’s repository, and connect to it on Render.
Once the deployment process is complete, copy the provided URL to test the endpoints on Postman.
Test the API Endpoints on Postman
Postman is a popular tool for developing and testing APIs.
To get familiar with Postman,learn how to use it to test an API.
To test the deployed API, make aPOSTrequest to the /usersendpoint to store data in the PostgreSQL database.
Finally, make a GET request to retrieve the stored data.