--- displayed_sidebar: servicesSidebar --- import ParameterTypes from "@site/src/components/ParameterTypes" # MiddlewareService Orchestrates dynamic middleware registered through the Medusa Middleware API ## constructor ___ ## Properties `", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ]} /> ___ ## Methods ### addPostAuthentication Adds a middleware function to be called after authentication is completed. #### Parameters `", "description": "the arguments that will be passed to the\n middleware", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ]} /> #### Returns ___ ### addPreAuthentication Adds a middleware function to be called before authentication is completed. #### Parameters `", "description": "the arguments that will be passed to the\n middleware", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ]} /> #### Returns ___ ### addPreCartCreation Adds a middleware function to be called before cart creation #### Parameters #### Returns ___ ### addRouter #### Parameters #### Returns ___ ### getRouters #### Parameters #### Returns ___ ### usePostAuthentication Adds post authentication middleware to an express app. #### Parameters #### Returns ___ ### usePreAuthentication Adds pre authentication middleware to an express app. #### Parameters #### Returns ___ ### usePreCartCreation #### Returns ___ ### validateMiddleware\_ Validates a middleware function, throws if fn is not of type function. #### Parameters #### Returns