From 32b5517e52d78860cf3d75a0744849f9c4c5ca08 Mon Sep 17 00:00:00 2001 From: Kelvin Oghenerhoro Omereshone Date: Fri, 1 Apr 2022 06:37:08 +0100 Subject: [PATCH] feat: fix typo --- docs/concepts/Middleware/Middleware.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/concepts/Middleware/Middleware.md b/docs/concepts/Middleware/Middleware.md index ac9628a659..ae75398a54 100644 --- a/docs/concepts/Middleware/Middleware.md +++ b/docs/concepts/Middleware/Middleware.md @@ -28,7 +28,7 @@ To configure a new custom HTTP middleware function, add a middleware function as With the exception of "order", which is reserved for configuring the order of the middleware stack, any value assigned to a key of `sails.config.middleware` should be a function which takes three arguments: `req`, `res` and `next`. This function works almost exactly like a [policy](https://sailsjs.com/documentation/concepts/policies), the only visible difference is when it's executed. ##### Initializing middleware -If you need to run some one-time set up code for a custom middleware function, you'll need to do so _before_ passing it in. The recommended way of doing this is with a self-calling (i.e. ["immediately-invoked"](https://en.wikipedia.org/wiki/Immediately-invoked_function_expression)) wrapper function. In the example below, note that rather than setting the value to a "req, res, next" function directly, a self-calling function is used to "wrap" some initial setup code. That self-calling wrapper function then returns the final middleware (req,res,next) function, so it gets set on the key just the same was as if it had been passed in directly. +If you need to run some one-time set up code for a custom middleware function, you'll need to do so _before_ passing it in. The recommended way of doing this is with a self-calling (i.e. ["immediately-invoked"](https://en.wikipedia.org/wiki/Immediately-invoked_function_expression)) wrapper function. In the example below, note that rather than setting the value to a "req, res, next" function directly, a self-calling function is used to "wrap" some initial setup code. That self-calling wrapper function then returns the final middleware (req,res,next) function, so it gets set on the key just the same way as if it had been passed in directly. ##### Example: using custom middleware The following example shows how you might set up three different custom HTTP middleware functions: