initial import

This commit is contained in:
SourceFellows
2020-08-21 06:26:40 +02:00
commit e223458dd4
423 changed files with 9871 additions and 0 deletions

View File

@ -0,0 +1,3 @@
module golang.source-fellows.com/samples/httpregistration
go 1.13

View File

@ -0,0 +1,21 @@
package main
import "net/http"
type MyHandler struct{}
func (mh *MyHandler) ServeHTTP(writer http.ResponseWriter, req *http.Request) {
writer.Write([]byte("Hello World (from ServeHTTP)"))
}
func handleHttp(res http.ResponseWriter, req *http.Request) {
res.Write([]byte("Hello World (from handleHttp)"))
}
func main() {
//Anmeldung der HandlerFunc Implementierung
http.HandleFunc("/func", handleHttp)
//Anmeldung der Handler Interface Implementierung
http.Handle("/handler", &MyHandler{})
http.ListenAndServe(":8080", &MyHandler{})
}