PostgreSQL and REST API


=> Download NodeJS from

=> Download and install PostgreSQL from

=> Good to have Postman installed as well from

=> Be familiar with JavaScript from


Once we have installed the PostgreSQL then we can create and build REST API.

=> Fire Visual Studio Code and create a folder called RESTAPI

=> Open a terminal (Terminal | New Terminal) and run the following command

npm init -y 

=> Hit enter and it will create a JSON file called package.json file under the RESTAPI folder

=> Install express framework by executing the following command

npm i --save express

=> Install PostgreSQl connector by executing the following command

npm i pg

Now create the structure of the folder of your project as you need.

=> Create  file called server.js with the following content

const express = require("express");
const app= express();
const port = 3000;
app.get("/", (req, res) => {
    res.send("Hello World, so far so good!");
app.listen(port, () => console.log(`app listening on port ${port}`));



See Also :