1234567891011121314151617181920212223242526 |
- package http
- import "net/http"
- type responsePayload struct {
- Code int `json:"code"`
- Reason string `json:"reason,omitempty"`
- Data any `json:"data,omitempty"`
- }
- type HandleFunc func(ctx *Context) (err error)
- type Middleware func(next HandleFunc) HandleFunc
- type Route struct {
- Method string
- Path string
- Handle HandleFunc
- }
- func Wrap(f http.HandlerFunc) HandleFunc {
- return func(ctx *Context) (err error) {
- f(ctx.Response(), ctx.Request())
- return
- }
- }
|