Express: an API server

Lesson 02 · 11 min

Middleware

A pipeline of functions before the handler: logging, auth, body parsing.

Middleware is a function (req, res, next). It can check something or add to req, then pass control on with next(). Or it can respond itself and stop the chain. The order of app.use matters: they run top to bottom.

Sign in to continue

The rest of this lesson opens after sign up

The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.