-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Breaking change in celeris core
The HandlerFunc type has changed from func(*Context) to func(*Context) error in v1.0.0.
Impact on examples
All example code must use the new signature. The repo is currently empty, but when examples are added they must follow the new patterns.
New handler signature
s.GET("/hello", func(c *celeris.Context) error {
return c.String(200, "Hello, World!")
})Middleware pattern
s.Use(func(c *celeris.Context) error {
start := time.Now()
err := c.Next()
log.Println("request", c.Method(), c.Path(), time.Since(start), err)
return err
})Error handling pattern
s.GET("/data", func(c *celeris.Context) error {
data, err := fetchData()
if err != nil {
return celeris.NewHTTPError(500, "fetch failed")
}
return c.JSON(200, data)
})New serialization features to demonstrate
c.XML(code, v)— XML responsec.ProtoBuf(code, msg)— Protocol Buffers responsec.Bind(v)— auto-detect format from Content-Type (JSON/XML/Protobuf)c.BindJSON(v),c.BindXML(v),c.BindProtoBuf(msg)— explicit format binding
Suggested examples to include
- Hello World (basic handler with error return)
- REST API (CRUD with JSON + error handling)
- Middleware chain (logging, recovery, auth — all error-aware)
- XML API (legacy/SOAP endpoint)
- Protobuf API (inter-service RPC)
- Content negotiation (Bind auto-detect)
- Custom error handler (HTTPError + middleware interception)
- net/http bridge (Adapt/AdaptFunc)
- Graceful shutdown
- Route groups with per-group middleware
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels