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.
- Host: GitHub
- URL: https://github.com/go-flexible/flexhttp
- Owner: go-flexible
- License: apache-2.0
- Created: 2021-06-13T20:52:43.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-05-13T10:39:41.000Z (almost 4 years ago)
- Last Synced: 2024-06-21T01:43:25.388Z (almost 2 years ago)
- Topics: 12-factor, go, golang, golang-library, http-server, microservice
- Language: Go
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flexhttp
[](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())
```