forked from WEB-IMB-WS2526/lab-development-imb
20 lines
448 B
Go
20 lines
448 B
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
type respExampleHandler int
|
|
|
|
func (hello respExampleHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("my-http-header", "Ein beliebiger Text")
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
w.WriteHeader(http.StatusFound)
|
|
w.Write([]byte("<h1>Dies ist eine HTML-Überschrift<h1>"))
|
|
}
|
|
|
|
func main() {
|
|
var r respExampleHandler
|
|
http.ListenAndServe("localhost:8080", r)
|
|
}
|