mirror of
https://github.com/SourceFellows/gobuch.git
synced 2025-08-03 05:02:16 +02:00
initial import
This commit is contained in:
16
microservices/http-metod-matching/main.go
Normal file
16
microservices/http-metod-matching/main.go
Normal file
@ -0,0 +1,16 @@
|
||||
package main
|
||||
|
||||
import "net/http"
|
||||
|
||||
func myHandler(res http.ResponseWriter, req *http.Request) {
|
||||
if req.Method == http.MethodGet {
|
||||
res.Write([]byte("Hello World"))
|
||||
} else {
|
||||
res.WriteHeader(http.StatusMethodNotAllowed)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/", myHandler)
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
Reference in New Issue
Block a user