Middlewares
aah framework provides a way to create user-defined Middleware
for your application very similar to Go lang standard middleware.
Table of Contents
Writing Middleware
To create your own custom middleware, just comply to aah.MiddlewareFunc
. Once you created the middleware function.
You can add your middleware into aah in three ways-
- Using standard
func init()
- Using
OnInit
event - Using
OnStart
event
Abort the Middleware Flow
You can abort the middleware flow in two ways.
Way One
Way Two
Bring Go lang native middleware into aah
aah framework expands the possibilities via reuse/existing middlewares.
- http.Handler
- http.HandlerFunc
func(http.ResponseWriter, *http.Request)