Skip to content

MiddlewareGroup

poteto edited this page Oct 29, 2024 · 1 revision

MiddlewareGroup

You can combine routers and apply middleware.

func main() {
	p := poteto.New()
	// Group of Middleware
	userGroup := p.Combine("/users")
	userGroup.Register(middleware.CamaraWithConfig(middleware.DefaultCamaraConfig))

	p.GET("/users", UserHandler)
	p.Get("/users/:id", UserIdHandler)
	p.Run(":8000")
}

versions

it requred >=0.12.0

Clone this wiki locally