Node.js Postgresql tutorial: Build a simple REST API with Express

A step-by-step guide from start to finish

Geshan Manandhar
DailyJS

--

Background Image from Unsplash

Node.js can be used efficiently with relational databases like PostgreSQL. In this post about Node.js PostgreSQL tutorial, we are going to build a REST API for Quotes step-by-step using Express Js.

You can read my previous tutorial to try Node.js with MySQL. You should read this guide to use Docker with Node.js, it is also a step-by-step guide. You can, of course, carry on with this Node.js with PostgreSQL tutorial :).

For your convinience, each step has been carved out as a distinct pull reqeust so that you can follow the tutorial with ease.

Prerequisites

  1. You have Node.js (preferably Node 14.x) installed and running on your machine (or Node.js running with a docker container).
  2. You are aware of how Node.js generally works and also have a bit of Express Js experience.
  3. Having some knowledge of Git and GitHub will be really useful.
  4. For the database we will use a free database on ElephantSQL, so please register and set up a free PostgreSQL database there. Of course, you should know how a relational database works.
  5. You are able to code using an IDE. I will be…

--

--

Geshan Manandhar
DailyJS

Senior Software Engineer, Agile follower. Technologist, Google Developer Expert. Blogging at geshan.com.np