Middleware

A middleware is a module with a default function that:

Usage

  • CMS integration that returns a page
  • Request Context enhancement such as adding a user via User Authentication

Registration

You can register your middleware:

Example:

json
{ "middlewares": [ { "importPath": "./cms/my-cms-middleware.js", "props": { "uri": "", "timeout": 1 } } ] }
  • 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

bash
interact config --filter="middlewares"

Example: How to create a page middleware

See the page provider cms integration