Skip to content

Commit

Permalink
fix: add note
Browse files Browse the repository at this point in the history
  • Loading branch information
GiveMe-A-Name committed May 22, 2024
1 parent 55f8bf0 commit 5b782e4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: Middleware

Used to extend the built-in Web Server of Modern.js, unlike [Hook](/apis/app/runtime/web-server/hook), Middleware can directly operate Node's origin request and response, and can be extended using the framework plugin.

:::warning
:::note
In the next major release, Modern.js will use new middleware to replace this approach.

It is recommended to use [UnstableMiddleware](/apis/app/runtime/web-server/unstable_middleware) to handle page requests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ For more detail, see [Hook](/apis/app/runtime/web-server/hook).
For some projects, there may be more requirements at the server level, Modern.js provides Middleware to add pre-middleware for Web Server. It can only run in a Node environment, so if the project is deployed to another environment, such as a Worker environment, Middleware cannot be used.
:::warning
:::note
In the next major release, Modern.js will use new middleware to replace this approach.
It is recommended to use [UnstableMiddleware](/guides/advanced-features/web-server.html#unstablemiddleware) to handle page requests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: Middleware

用于拓展 Modern.js 内置的 Web Server,与 [Hook](/apis/app/runtime/web-server/hook) 不同的是,Middleware 可以直接操作 Node 原生的请求、响应对象,并且可以使用框架拓展。

:::warning
:::note
在下一个大版本,Modern.js 将会使用新 Middleware 来替代该写法。

推荐使用 [UnstableMiddleware](/apis/app/runtime/web-server/unstable_middleware) 处理页面请求。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const afterRender: AfterRenderHook = (ctx, next) => {

对于某些项目,可能在服务端有更多的需求,Modern.js 提供了 Middleware 为 Web Server 添加前置中间件。它只能运行在 Node 环境下,因此如果项目被部署到其他环境中,如 Worker 环境,则不可以使用 Middleware。

:::warning
:::note
下一个大版本,Modern.js 将会使用新 Middleware 来替代该写法。

推荐使用 [UnstableMiddleware](/guides/advanced-features/web-server.html#unstablemiddleware) 处理页面请求。
Expand Down

0 comments on commit 5b782e4

Please sign in to comment.