Express: small Node.js API
Express is routing plus middleware and deliberately little else. A JSON API fits in one readable file: define routes, validate input at the edge with one middleware, and keep business logic in plain functions you can test without HTTP.
npm install express
Stop before the framework grows teeth: authentication, validation and rate limiting are middleware, but once you need an ORM, migrations and background jobs, graduate to a full framework instead of stacking forty middlewares. Serve the result behind a real reverse proxy, and read the Node.js notes for runtime behavior.
Errors: fail loud, fail once
An Express handler that throws without error middleware hangs the request until timeout — the worst possible failure mode. Add one error-handling middleware that logs with a request id and returns a stable JSON shape, wrap async handlers so rejections reach it, and never leak stack traces to clients. One place, all errors, always.
Validate at the edge
Every route validates its input before touching business logic: types, ranges, string lengths. A tiny schema check per route beats defensive ifs scattered through handlers, and it documents the API better than any wiki page. Invalid input gets a 400 with the field names — clients fix themselves instead of filing tickets.
| NPM: packages without pain | |
| React in one evening | |
| Vite: instant dev server |