Procyon|Docs
HTTPRouting

Groups

Keep related endpoints under shared route prefixes.

Use endpoint groups when a set of routes share a prefix.

routes.go
func (c *UserController) ConfigureEndpoints(endpoints http.Endpoints) {
	api := endpoints.MapGroup("/api")
	users := api.MapGroup("/users")

	users.MapGet("/{id}", http.HandleResult(c.getUser))
	users.MapPost("/", http.HandleResult(c.createUser))
}

Groups make route modules easier to read as the application grows. They also avoid repeating the same prefix across every mapping call.

Nested groups

Groups can be nested for versioned APIs or feature areas.

routes.go
func (c *AdminController) ConfigureEndpoints(endpoints http.Endpoints) {
	v1 := endpoints.MapGroup("/api/v1")
	admin := v1.MapGroup("/admin")

	admin.MapGet("/users", http.HandleResult(c.listUsers))
	admin.MapPost("/users/{id}/lock", http.Handle(c.lockUser))
}

Keep grouping structural. Business decisions should stay inside handlers and services, not inside route prefix logic.

On this page