From bfdb2e5237634cd98befab41b15f688fca52a035 Mon Sep 17 00:00:00 2001 From: Kinfe123 Date: Tue, 8 Apr 2025 20:00:34 +0300 Subject: [PATCH] fix: plugin middleware docs --- docs/content/docs/concepts/plugins.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/content/docs/concepts/plugins.mdx b/docs/content/docs/concepts/plugins.mdx index 002b8280b6..b02bf2aa14 100644 --- a/docs/content/docs/concepts/plugins.mdx +++ b/docs/content/docs/concepts/plugins.mdx @@ -266,7 +266,7 @@ const myPlugin = ()=>{ ### Middleware -You can add middleware to the server by passing a `middleware` array. This array should contain middleware objects, each with a `path` and a `middleware` property. Unlike hooks, middleware only runs on `api` requests from a client. If the endpoint is invoked directly, the middleware will not run. +You can add middleware to the server by passing a `middlewares` array. This array should contain middleware objects, each with a `path` and a `middleware` property. Unlike hooks, middleware only runs on `api` requests from a client. If the endpoint is invoked directly, the middleware will not run. The `path` can be either a string or a path matcher, using the same path-matching system as `better-call`. @@ -276,7 +276,7 @@ If you throw an `APIError` from the middleware or returned a `Response` object, const myPlugin = ()=>{ return { id: "my-plugin", - middleware: [ + middlewares: [ { path: "/my-plugin/hello-world", middleware: createAuthMiddleware(async(ctx)=>{ @@ -321,7 +321,7 @@ The `onResponse` function is executed immediately after a response is returned. Here’s how to use it: - **Modify the Response**: You can return a modified response object to change the response before it is sent to the client. -- **Continue Normally**: If you don’t return anything, the response will be sent as is. +- **Continue Normally**: If you don't return anything, the response will be sent as is. ```ts title="plugin.ts" const myPlugin = ()=>{