Test out some pattern-matching syntax

This commit is contained in:
Lewis Dale 2024-05-05 08:41:01 +01:00
parent a4bf9c140f
commit b0fda7e317
1 changed files with 5 additions and 2 deletions

View File

@ -5,8 +5,11 @@ import (
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello, World!"))
http.HandleFunc("GET /", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("This was a GET request!"))
})
http.HandleFunc("POST /", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("This was a POST request!"))
})
http.ListenAndServe(":8000", nil)
}