mirror of
https://github.com/hanzoai/zip.git
synced 2026-10-30 20:11:40 +00:00
The import path a reader types is the one the org owns, rather than the forge that happens to host the bytes. hanzo.ai serves the go-import meta and points it at the same repository, so where the code lives does not change. The README's `go get` line moves with it — an install instruction naming the old path is the one leftover a reader would actually follow.
27 lines
548 B
Go
27 lines
548 B
Go
// Hello, zip — minimal example.
|
|
//
|
|
// go run ./examples/hello
|
|
// curl http://localhost:8080/hello
|
|
package main
|
|
|
|
import (
|
|
"log"
|
|
|
|
"hanzo.ai/zip"
|
|
"hanzo.ai/zip/middleware"
|
|
)
|
|
|
|
func main() {
|
|
app := zip.New(zip.Config{AppName: "hello"})
|
|
app.Use(middleware.Recover(), middleware.RequestID())
|
|
|
|
app.Get("/hello", func(c *zip.Ctx) error {
|
|
return c.JSON(200, map[string]string{"message": "hello world"})
|
|
})
|
|
app.Get("/health", func(c *zip.Ctx) error {
|
|
return c.JSON(200, map[string]string{"status": "ok"})
|
|
})
|
|
|
|
log.Fatal(app.Listen(":8080"))
|
|
}
|