Installation
Requirements
Section titled “Requirements”- Go 1.26 or later
- A Chi router (Kori builds on top of it)
Install
Section titled “Install”Install Kori and Chi:
go get github.com/douglasmai4/korigo get github.com/go-chi/chi/v5Create a project
Section titled “Create a project”mkdir my-api && cd my-apigo mod init my-apigo get github.com/douglasmai4/korigo get github.com/go-chi/chi/v5Create main.go:
package main
import ( "net/http"
"github.com/go-chi/chi/v5" "github.com/douglasmai4/kori")
func main() { r := chi.NewRouter()
kori.GET(r, "/health", func(w http.ResponseWriter, r *http.Request) error { return kori.Text(w, http.StatusOK, "ok") })
http.ListenAndServe(":8080", r)}Run it:
go run .curl http://localhost:8080/health# ok