From b0fda7e3176ecb81b3f6a472817a553455c0a558 Mon Sep 17 00:00:00 2001 From: Lewis Dale Date: Sun, 5 May 2024 08:41:01 +0100 Subject: [PATCH] Test out some pattern-matching syntax --- main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 8eab99b..abdbb5b 100644 --- a/main.go +++ b/main.go @@ -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) }