Created
August 30, 2017 15:46
-
-
Save dooferlad/987215adb8d9da56b556b449236f0d28 to your computer and use it in GitHub Desktop.
An HTTP server that responds slowly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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