Skip to content

Latest commit

 

History

History
26 lines (21 loc) · 960 Bytes

README.md

File metadata and controls

26 lines (21 loc) · 960 Bytes

flexhttp

Go Reference Go

A flex compatible http server.

// Create some router and endpoints...
router := http.NewServeMux()
router.HandleFunc("/", func(rw http.ResponseWriter, r *http.Request) {
        fmt.Fprint(rw, "Hello, world!\n")
})

// Create a standard http server.
srv := &http.Server{
        Addr:              ":8080",
        Handler:           router,
        ReadTimeout:       5 * time.Second, 
        ReadHeaderTimeout: time.Second,
        // Missing timeouts will be set to a sane default.
}

// Run it, or better yet, let `flex` run it!
flexhttp.New(srv).Run(context.Background())