Skip to content

Instantly share code, notes, and snippets.

@dooferlad
Created August 30, 2017 15:46
Show Gist options
  • Save dooferlad/987215adb8d9da56b556b449236f0d28 to your computer and use it in GitHub Desktop.
Save dooferlad/987215adb8d9da56b556b449236f0d28 to your computer and use it in GitHub Desktop.
An HTTP server that responds slowly.
package main
import (
"fmt"
"log"
"net/http"
"time"
"github.com/julienschmidt/httprouter"
)
func Hello(w http.ResponseWriter, _ *http.Request, _ httprouter.Params) {
time.Sleep(time.Second * 30)
fmt.Fprintf(w, "hello!\n")
}
func main() {
router := httprouter.New()
router.GET("/*name", Hello)
log.Fatal(http.ListenAndServe(":8001", router))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment