Node.js: Build and Ship an API
Exit

Lesson 9 of 14 · Servers and APIs

Connecting PostgreSQL: pg, parameterized queries, pool and migrations

1 h 5 min Node.js 22 (Debian, git, npm, python3)

Objective

Replace the in-memory arrays with a real PostgreSQL database: connect with the pg driver, write parameterized queries (the only serious protection against SQL injection), share connections with a pool, group writes in a transaction and evolve the schema with migrations.

This lesson is part of the full course

Unlock Node.js: Build and Ship an API to read every lesson, do the exercises, access the simulations and earn your certificate.

Already enrolled? Log in.