Golang net/http.TimeoutHandler() function example
package net/http
Golang net/http.TimeoutHandler() function usage example
package main
import (
"net/http"
"time"
)
func main() {
h := http.FileServer(http.Dir("/tmp"))
dt := 2 * time.Second
http.ListenAndServe(":8080", http.TimeoutHandler(h, dt, "file scanning timed out!"))
}
Reference :
Advertisement
Something interesting
Tutorials
+12.4k Golang : Encrypt and decrypt data with x509 crypto
+13.4k Golang : Verify token from Google Authenticator App
+6.2k Linux/Unix : Commands that you need to be careful about
+22.7k Golang : Round float to precision example
+11.9k Golang : How to parse plain email text and process email header?
+11.3k Golang : How to use if, eq and print properly in html template
+18.6k Golang : Generate thumbnails from images
+16k Golang : How to reverse elements order in map ?
+6.1k Golang : Measure execution time for a function
+5.5k Golang : Stop goroutine without channel
+25.7k Golang : missing Mercurial command
+15.9k Golang : Get current time from the Internet time server(ntp) example