forked from WEB-IB-SS26/development-ib
20 lines
507 B
Go
20 lines
507 B
Go
package main
|
|
|
|
import "net/http"
|
|
|
|
type respExampleHandler int //typ ist egal => interface wichtig!!
|
|
|
|
func (hello respExampleHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { //Bedienung
|
|
w.Header().Set("custom_header", "Beleibiger Text")
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
w.WriteHeader(http.StatusFound)
|
|
w.Write([]byte("<h1> Dies ist eine HTML-Ueberschrift</h1>"))
|
|
|
|
}
|
|
|
|
func main() {
|
|
var r respExampleHandler
|
|
|
|
http.ListenAndServe("localhost:8080", r) //Türsteher
|
|
}
|