Posts about Node.js
About the Node.js series
Node.js Feb 7, 2022
In a series of blog posts, I'm going to describe an opinionated Node.js microservice architecture. Let me tell you about the why, what and how of this series.
- Node.js
- TypeScript
- Express.js
Organizing Express.js endpoints
Node.js Feb 9, 2022
Learn how to organize the endpoints in a TypeScript Express.js service. Why a REST resource should have its own DAO and why you don't need three layers.
- Node.js
- TypeScript
- Express.js
Testing Express.js endpoints with supertest
Node.js Feb 11, 2022
Learn to write Jest unit tests with supertest to test Express.js controllers in a TypeScript Node.js service.
- Node.js
- TypeScript
- Express.js
- Jest
OpenAPI input validation in Express.js
Node.js Feb 16, 2022
Learn how to validate inputs with an OpenAPI spec in a TypeScript Express.js service. Write tests for the input validation and return meaningful HTTP errors.
- Node.js
- Express.js
- TypeScript
- OpenAPI
JSON Logging with Pino in Express.js
Node.js Mar 10, 2022
Learn how to add the JSON Pino logger into a TypeScript Express.js service. Log HTTP requests automatically, avoid logging in tests and prettify the JSON logs.
- Node.js
- Express.js
- TypeScript
- Pino
Managing configs with TypeScript code in Node.js
Node.js Mar 21, 2022
Learn how to build local and production configs within TypeScript code instead of JSON or YAML files. Part 6 of the Node.js microservice architecture series.
- Node.js
- TypeScript
JWT authentication with JWKS in Express.js
Node.js Apr 2, 2022
Learn how to implement JWT authentication with JWKS in a TypeScript Express.js service. How to disable auth locally and suppress tokens in production logs.
- Node.js
- TypeScript
- Express.js
- JWT
- Pino
Resolve a list of promises synchronously
Coding Apr 15, 2022
Learn how to execute and resolve a list of JavaScript promises synchronously instead of in parallel with Promise.all.
- Node.js
- TypeScript
- JavaScript
Connecting a Node.js app with a Postgres database
Node.js Apr 16, 2022
Learn how to connect a Node.js application both with a local Postgres database in docker-compose and with a production database.
- Node.js
- TypeScript
- Knex
- Postgres
- Docker
Knex.js schema migrations with Postgres in Node.js
Node.js Apr 20, 2022
Learn how to use Knex.js schema migrations to create a first Postgres database table. Setup scripts to allow a local database reset.
- Node.js
- TypeScript
- Knex
- Postgres
Creating a Node.js DAO with Knex.js
Node.js Apr 24, 2022
Learn how to build a DAO in Node.js to execute SQL queries with Knex.js. Providing CRUD operations for a REST entity persisted in the PostgreSQL database.
- Node.js
- TypeScript
- Knex
- Postgres
Testing Knex SQL queries with Jest and testcontainers
Node.js May 20, 2022
Learn to test your Knex SQL queries with a single automatically spawned Docker Postgres database. Using testcontainers and Jest global setup and teardown.
- Node.js
- TypeScript
- Knex
- Postgres
- Testcontainers
Single schema multi-tenancy in Node.js with Postgres
Node.js May 21, 2022
Learn to do multi-tenancy in a single Postgres schema in a TypeScript Node.js app. Avoid performance overhead while minimizing the risk of data exposure.
- Node.js
- TypeScript
- Express.js
- Knex
- Postgres
- JWT
Organizing and testing HTTP requests
Node.js May 24, 2022
Learn to send HTTP requests with Axios in a TypeScript Node.js service. How to mock responses in local development and tests with Jest, mockserver and supertest.
- Node.js
- TypeScript
- Express.js
- Axios
- Jest
Connection pooling with Axios and agentkeepalive
Node.js May 25, 2022
Learn to use a connection pool with Axios and agentkeepalive for HTTP requests in a TypeScript Node.js service.
- Node.js
- TypeScript
- Axios
Pino JSON logging of Axios HTTP requests
Node.js May 25, 2022
Learn to configure the Pino JSON logger to automatically log each outgoing Axios HTTP request.
- Node.js
- TypeScript
- Axios
- Pino
Axios HTTP error handling in Express.js
Node.js May 26, 2022
Don't catch all exceptions! Learn to handle erroneous HTTP responses of Axios with an Express.js handler returning a 500 and logging an error.
- Node.js
- TypeScript
- Express.js
- Axios
- Pino
Axios HTTP request authentication with JWT
Node.js May 26, 2022
Learn to authenticate outgoing HTTP requests with Axios interceptors. Retrieving JWT with different scope, caching the JWT and attaching the authorization header.
- Node.js
- TypeScript
- Axios
- JWT
Node.js subcommands without CLI library
Node.js Jun 2, 2022
Learn to start your Node.js application with different subcommands. Implement a server mode beside commands for batch jobs in the same codebase.
- Node.js
- TypeScript
Building an asynchronous batch job
Node.js Jun 3, 2022
Learn to structure an asynchronous batch job in a Node.js application and how to isolate the functionality from the endpoint controllers.
- Node.js
- TypeScript
- Knex
- Pino
Building an idempotent cron job with at-least-once delivery
Node.js Jun 9, 2022
Learn to build an idempotent at-least-once delivery of notifications in a scheduled Node.js batch job.
- Node.js
- TypeScript
- Knex