gaper/testdata/server/main.go

22 lines
413 B
Go
Raw Normal View History

2018-06-16 19:22:21 -05:00
package main
import (
"fmt"
"html"
"log"
"net/http"
)
func main() {
2018-06-18 22:50:05 -05:00
http.HandleFunc("/foo", func(w http.ResponseWriter, r *http.Request) {
2018-06-16 19:22:21 -05:00
fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path)) // nolint gas
})
2018-06-18 22:50:05 -05:00
http.HandleFunc("/bar", func(w http.ResponseWriter, r *http.Request) {
log.Fatal("Forced failure")
})
2018-06-16 19:22:21 -05:00
log.Println("Starting server")
log.Fatal(http.ListenAndServe(":8080", nil))
}