中间件配置
¥Middlewares configuration
Page summary:
/config/middlewaresorders global middleware, enables custom names or resolves, and exposes built-in configuration options.
在 Strapi 中,3 个中间件概念共存:
¥In Strapi, 3 middleware concepts coexist:
-
整个 Strapi 服务器应用的全局中间件是 配置并启用。这些中间件可以应用于应用级别或 API 级别。
当前文档描述了如何实现它们。
插件还可以添加全局中间件(参见 服务器 API 文档)。¥Global middlewares are configured and enabled for the entire Strapi server application. These middlewares can be applied at the application level or at the API level.
The present documentation describes how to implement them.
Plugins can also add global middlewares (see Server API documentation). -
路由中间件的范围更有限,并且在路由级别被配置和用作中间件。它们在 路由文档 中进行了描述。
¥Route middlewares have a more limited scope and are configured and used as middlewares at the route level. They are described in the routes documentation.
-
文档服务中间件适用于文档服务 API,并具有自己的 implementation 和相关的