Write the common path quickly.
Concise routes, groups, binding, response helpers, and one central place for errors.
app.Get("/users/{id}", showUser)Routing, binding, errors, and middleware on top of the HTTP stack you already know. Zinc stays small enough to get out of the way.
package main
import (
"log"
"github.com/0mjs/zinc"
)
func main() {
app := zinc.New()
app.Get("/", func(c *zinc.Context) error {
return c.JSON(zinc.Map{
"message": "Hello from Zinc!",
})
})
log.Fatal(app.Listen(":8080"))
}HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{"message":"Hello from Zinc!"}Zinc fills the practical gaps above the standard library. Nothing underneath is replaced.
Concise routes, groups, binding, response helpers, and one central place for errors.
app.Get("/users/{id}", showUser)A Zinc app is an http.Handler. The original request and response writer stay available.
server.Handler = appMount existing handlers and wrap the application with ordinary HTTP middleware.
app.HandleHTTP(pattern, handler)Own your server configuration, use Go-style brace routes, and move between Zinc and standard handlers without adapters.
See net/http interoperability →your codehttp.Handlerstandard libraryChoose the shortest API for your own code. Keep third-party and standard-library integrations standard.
app.Get("/users/{id}", func(c *zinc.Context) error {
return c.String(c.Param("id"))
})app.HandleHTTP(
"GET /metrics",
promhttp.Handler(),
)server := &http.Server{
Addr: ":8080",
Handler: app,
}
log.Fatal(server.ListenAndServe())On the latest published comparison, Zinc recorded the lowest latency in 62 of 77 comparable benchmarks against Gin, Echo, and Chi.
Read the benchmark report →Build something new or introduce Zinc to an existing Go service without changing the rest of your stack.