skip to content
Alvin Lucillo

HTTP verbs in Go 1.22

/ 1 min read

💻 Tech

With Go 1.22, you can specify the HTTP verbs (e.g., GET, POST) in handler function registration.

router := http.NewServeMux()
router.HandleFunc(" POST /hello", func(w http.ResponseWriter, r *http.Request) {
    fmt.Fprint(w, "Hello, World!")
})