An open API service indexing awesome lists of open source software.

https://github.com/go-flexible/flexhttp

A flex compatible http server.
https://github.com/go-flexible/flexhttp

12-factor go golang golang-library http-server microservice

Last synced: 3 months ago
JSON representation

A flex compatible http server.

Awesome Lists containing this project

README

          

# flexhttp

Go Reference
[![Go](https://github.com/go-flexible/flexhttp/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/go-flexible/flexhttp/actions/workflows/go.yml)

A [flex](https://github.com/go-flexible/flex) compatible http server.

```go
// 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())
```