doc: middleware-s can be async

Massimo Melina committed Jun 4, 2024 at 12:14 UTC c24769e742ade8687295c0b0aa19cb4402e7ea18
1 file changed +2 -2
dev-plugins.md
+2 -2
@@ -80,7 +80,7 @@ used must be strictly JSON (thus, no single quotes, only double quotes for strin
80 You can also include external files, by entering a full URL. Multiple files can be specified as `['file1.css', 'file2.css']`.
81 - `frontend_js: string | string[]` path to one or more js files that you want the frontend to load. These are to be placed in the `public` folder (refer below).
82 You can also include external files, by entering a full URL.
83 -- `middleware: (Context) => void | true | function` a function that will be used as a middleware: use this to interfere with http activity.
83 +- `middleware: (Context) => Promisable<void | true | function>` a function that will be used as a middleware: use this to interfere with http activity.
84
85 ```js
86 exports.middleware = ctx => {
@@ -90,7 +90,7 @@ used must be strictly JSON (thus, no single quotes, only double quotes for strin
90 ```
91 You'll find more examples by studying plugins like `antidos` or `antibrute`.
92 To interrupt other middlewares on this http request, return `true`.
93 - If you want to execute something in the "upstream" of middlewares, return a function.
93 + If you want to execute something in the "upstream" of middlewares, return a function. This function can be async.
94 You can read more in [the ctx object](#the-ctx-object) section.
95
96 - `unload: function` called when unloading a plugin. This is a good place for example to clearInterval().