--- 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":[]}]} sectionTitle="MiddlewareService"/> ___ ## Methods ### addRouter #### Parameters #### Returns ### getRouters #### Parameters #### Returns ### validateMiddleware\_ Validates a middleware function, throws if fn is not of type function. #### Parameters #### Returns ### 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":[]}]} sectionTitle="addPostAuthentication"/> #### 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":[]}]} sectionTitle="addPreAuthentication"/> #### Returns ### addPreCartCreation Adds a middleware function to be called before cart creation #### 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