https://github.com/go-http-utils/timeout
:stopwatch:HTTP timeout middleware for Go
https://github.com/go-http-utils/timeout
Last synced: 5 months ago
JSON representation
:stopwatch:HTTP timeout middleware for Go
- Host: GitHub
- URL: https://github.com/go-http-utils/timeout
- Owner: go-http-utils
- License: mit
- Created: 2016-11-29T02:31:48.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-29T06:52:23.000Z (over 9 years ago)
- Last Synced: 2024-09-09T10:27:28.449Z (almost 2 years ago)
- Language: Go
- Homepage: https://godoc.org/github.com/go-http-utils/timeout
- Size: 3.91 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# timeout
[](https://travis-ci.org/go-http-utils/timeout)
[](https://coveralls.io/github/go-http-utils/timeout?branch=master)
HTTP timeout middleware for Go.
## Installation
```go
go get -u github.com/go-http-utils/timeout
```
## Documentation
API documentation can be found here: https://godoc.org/github.com/go-http-utils/timeout
## Usage
```go
import (
"github.com/go-http-utils/timeout"
)
```
```go
mux := http.NewServeMux()
mux.HandleFunc("/", func(res http.ResponseWriter, req *http.Request) {
res.Write([]byte("Hello World"))
})
http.ListenAndServe(":8080", timeout.Handler(mux, time.Second*10, timeout.DefaultTimeoutHandler))
```