Skip to main content

Standardizing Routes

GoFrame provides a standardized way to register routes. The registration method is as follows:

func Handler(ctx context.Context, req *Request) (res *Response, err error)

Where Request and Response are custom structs.

Specify the request method and path as follows:

type HelloReq struct {
g.Meta `path:"/hello" method:"get"`
}