Middleware

Filter HTTP requests entering your application.


Global Middleware

Global middleware runs on every HTTP request to your application.

r := routix.New()

// Register global middleware
r.Use(routix.Logger())
r.Use(routix.Recovery())
r.Use(routix.CORS())

Route Middleware

You can assign middleware to specific routes by passing them as additional arguments.

// Only run AuthMiddleware on this route
r.GET("/dashboard", AuthMiddleware, func(c *routix.Context) error {
    return c.String(200, "Dashboard")
})