Registry / web-framework / go-chi-binding

go-chi-binding

JSON →
library0.0.0-20230415142243-04b515c6d669gogounverified

Package binding provides request data binding and validation middleware for Chi.

go get gitea.com/go-chi/binding
INSTALL
IMPORT
SIG · GO-CHI-BINDING
G
go-chi-binding
web-frameworkgov0.0.0-20230415142243-04b515c6d669
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

binding
gitea.com/go-chi/binding

Bind and validate request data in a Chi handler

package main import ( "net/http" "gitea.com/go-chi/binding" "github.com/go-chi/chi" ) type Input struct { Name string `json:"name" binding:"required"` } func handler(w http.ResponseWriter, r *http.Request) { var input Input if err := binding.Bind(r, &input); err != nil { http.Error(w, err.Error(), http.StatusBadRequest) return } } func main() { r := chi.NewRouter() r.Post("/", handler) http.ListenAndServe(":8080", r) }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
0.0.0-20230415142243-04b515c6d669latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
Bingbot
1
Resources
go-chi-binding — go get go-chi-binding · libregistry