Test out some pattern-matching syntax
This commit is contained in:
parent
a4bf9c140f
commit
b0fda7e317
7
main.go
7
main.go
@ -5,8 +5,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("GET /", func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Write([]byte("Hello, World!"))
|
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)
|
http.ListenAndServe(":8000", nil)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user