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 response
c.ProtoBuf(code, msg) — Protocol Buffers response
c.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
Breaking change in celeris core
The
HandlerFunctype has changed fromfunc(*Context)tofunc(*Context) errorin 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
Middleware pattern
Error handling pattern
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 bindingSuggested examples to include