v4 code migration: Updating global middlewares
This guide is part of the v4 code migration guide designed to help you migrate the code of a Strapi application from v3.6.x to v4.0.x
🤓 v3/v4 comparison
Strapi v4 only introduces small modifications to the structure of a global middleware, allowing for additional configuration parameters to be passed without the need to manually pull in the configuration via the Strapi API.
The configuration of middlewares has changed (see configuration migration).
The strapi generate
interactive CLI is the recommended way to create a new middleware:
- Run
yarn strapi generate
in a terminal. - Using the interactive CLI, choose where the middleware should apply and give it a name.
- Add customizations to the generated file.