github.com/mattevans/edward@v1.9.2/examples/warmup/pause/main.go (about)

     1  // A simple service that pauses before sending HTTP responses
     2  package main
     3  
     4  import (
     5  	"fmt"
     6  	"net/http"
     7  	"time"
     8  )
     9  
    10  func handler(w http.ResponseWriter, r *http.Request) {
    11  	// Pause to force the user to wait
    12  	time.Sleep(time.Second * 5)
    13  	fmt.Fprintf(w, "Hope that didn't time out!")
    14  }
    15  
    16  func main() {
    17  	http.HandleFunc("/", handler)
    18  	fmt.Println("Starting to listen on port 8080")
    19  	http.ListenAndServe(":8080", nil)
    20  }