Build a RESTful API with Node.js, Express and PostgreSQL

Build a RESTful API with Node.js, Express and PostgreSQL

English | MP4 | AVC 1280×720 | AAC 44KHz 2ch | 2 Hours | 501 MB

Create your own API server running on Node.js and hooked up to an active PostgreSQL database.

A useful and handy aspect of being a modern web developer is knowing how to work with APIs to facilitate communication between different software systems.

In this course, you’ll learn how to create your own RESTful API in a Node.js environment running on an Express server and utilizing a PostgreSQL database. We will use Postman as our API client to interact with the API Server.

REST stands for Representational State Transfer and defines a set of standards for web services. It is an architectural style as well as an approach for communications purposes that is often used in various web services development.

An API is an interface that different software programs use to communicate with each other.

RESTful API is an API that conforms to the REST architectural style and constraints. REST systems are stateless, scalable,cacheable, and have a uniform interface.

RESTful APIs most commonly utilize HTTP requests.Four of the most common HTTP methods are :

GET, POST, PUT, and DELETE, which are the methods by which a developer can create a CRUD system – create, read, update, delete. REST it is an application program interface (API) that makes use of the HTTP requests to GET, PUT, POST and DELETE the data over WWW. (World Wide Web)

The main functions used in any REST-based architecture are:

GET − Provides read-only access to a resource.

PUT − Creates a new resource.

DELETE − Removes a resource.

POST − Updates an existing resource or creates a new resource.

You learn how to:

  • Create a new database user account
  • Create a database and a table
  • Insert data into database
  • Build an express server
  • Connect to PostgreSQL Database from Node application
  • Create Route Functions
  • Export route functions into main application file
  • Create endpoints for route functions
  • Call the web API with Postman and perform CRUD operations

What you’ll learn

  • Installing PostgreSQL, Nodejs and Express
  • Creating new database user account (role)
  • Creating database and table
  • Inserting data into database table
  • Connecting to database from nodejs application
  • Create Route Functions
  • Export functions
  • Create endpoints for CRUD operation on API
  • Testing API using Postman as API Client
Table of Contents

Introduction
1 Introduction
2 What is an API
3 What is Node.js
4 What is Express
5 What is PostgreSQL
6 What is SQL

Installations
7 Installing PostgreSQL
8 Installing Node.js
9 Updating NPM
10 Installing ATom
11 Installing nodemon
12 Installing Postman

Database Setup
13 Connecting to database from Psql Shell
14 Creating a new role ( user account) on PostgresQL
15 Create a new database
16 Create a table
17 Inserting Data into database

Setting up Express Server
18 Creating a package.json file
19 Installing Express
20 Installing node-postgres (pg)
21 Creating application file
22 Starting Express Server
23 Connecting to database from Node.js

Creating Route Functions
24 Create Route to Get all data from database table
25 Create Route to Get a single record from database table
26 Create Route to Add a new record to database table
27 Create Route to UPDATE a single record from database table
28 Create Route to DELETE a record from database table
29 Exporting Route Functions
30 Creating endponts for Route Functions
31 Testing API with Postman
32 Project Code