Open
Description
e := echo.New()
e.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
log.Println("middleware...")
return next(c)
}
})
e.GET("/hello", func(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
})
e.Logger.Fatal(e.Start(":1323"))
Accessing a non-existent route, but passing through the middleware first, this situation also applies to route groups
There is usually an authorization authentication in the middleware. If you access a non-existent route, it will go through the middleware first, which will waste unnecessary processing and add additional judgment logic.
Metadata
Metadata
Assignees
Labels
No labels