Skip to content

Can add NoRoute(h HandlerFunc, m ...MiddlewareFunc) to Group and Echo?  #856

Closed
@mei-rune

Description

@mei-rune

Description

Can add NoRoute(h HandlerFunc, m ...MiddlewareFunc) to Group and Echo?
There are NoRoute() in https://github.com/gin-gonic/gin.

NoRoute() usage:

package mai

func main() {
	engine := echo.New()
	engine.Use(middleware.Logger())
	engine.Use(middleware.Recover())
       engine.NoRoute(http.DefaultServeMux)


       q := engine.Group("/query")
       q.GET("/hello", func(ctx echo.Context) error {
           ctx.String(http.StatusOK "hi!")
       })
       q.NoRoute(func(ctx echo.Context) error {
           ctx.String(http.StatusNotFound, "not found with prefix is /query")
       })
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions