24 lines
379 B
Go
24 lines
379 B
Go
package main
|
|
|
|
import (
|
|
"io"
|
|
"log"
|
|
"net/http"
|
|
)
|
|
|
|
type MyHandler int
|
|
|
|
func (MyHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
|
|
resp.Header().Set("Content-Type", "text/plain")
|
|
io.WriteString(resp, req.RequestURI)
|
|
}
|
|
|
|
func main() {
|
|
var myHandler = new(MyHandler)
|
|
s := &http.Server{
|
|
Addr: ":9000",
|
|
Handler: myHandler,
|
|
}
|
|
log.Fatal(s.ListenAndServe())
|
|
}
|