Middleware are classes, that can be assigned to one or more route, and are used to make actions in the early or final phases of the request cycle. We can think of them as a series of layers an HTTP request has to pass through while it's executed


A "Before" middleware will executes before the controller action code; while a "After" middleware executes after the request is handled by the application