update dependencies
This commit is contained in:
parent
fce1b99683
commit
397e9c0842
164 changed files with 5207 additions and 2213 deletions
33
vendor/github.com/go-chi/chi/_examples/custom-method/main.go
generated
vendored
Normal file
33
vendor/github.com/go-chi/chi/_examples/custom-method/main.go
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-chi/chi"
|
||||
"github.com/go-chi/chi/middleware"
|
||||
)
|
||||
|
||||
func init() {
|
||||
chi.RegisterMethod("LINK")
|
||||
chi.RegisterMethod("UNLINK")
|
||||
chi.RegisterMethod("WOOHOO")
|
||||
}
|
||||
|
||||
func main() {
|
||||
r := chi.NewRouter()
|
||||
r.Use(middleware.RequestID)
|
||||
r.Use(middleware.Logger)
|
||||
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("hello world"))
|
||||
})
|
||||
r.MethodFunc("LINK", "/link", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("custom link method"))
|
||||
})
|
||||
r.MethodFunc("WOOHOO", "/woo", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("custom woohoo method"))
|
||||
})
|
||||
r.HandleFunc("/everything", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("capturing all standard http methods, as well as LINK, UNLINK and WOOHOO"))
|
||||
})
|
||||
http.ListenAndServe(":3333", r)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue