A middleware is a module with a default function that:
- takes as input a context object with the HTTP request
- and returned:
- a Web Api HTTP Response
- or a page
Usage
- CMS integration that returns a page
- Request Context enhancement such as adding a user via User Authentication
Registration
You can register your middleware:
- automatically by storing it in the middlewares directory (src/middlewares by default)
- in the middelwares node of the configuration file
Example:
- They are executed in natural order.
- The import path may be relative to the root directory
How to list the middlewares
You can check them with the cli
Example: How to create a page middleware
See the page provider cms integration