Skip to main content

Middleware

A middleware is defined using the #Middleware annotation.

ArgumentsTypeDescriptionOptionalDefault Value
OrdernumberExecution order relative to other middlewares.Yes1
PathStartsstringTargets a subset of routes for the execution of this middleware.Yes/
AfterbooleanIf false, the middleware will be executed before the procedure. If true, it will be executed after.Yesfalse

Examples:

#Middleware(Order = 1, PathStarts = "/api")
#Middleware(Order = 1, PathStarts = "/api", After = true)