https://github.com/rosbit/http-p2s
a middleware to narrow the HTTP request traffic
https://github.com/rosbit/http-p2s
Last synced: 4 months ago
JSON representation
a middleware to narrow the HTTP request traffic
- Host: GitHub
- URL: https://github.com/rosbit/http-p2s
- Owner: rosbit
- License: mit
- Created: 2019-08-27T07:35:20.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-27T07:38:59.000Z (almost 6 years ago)
- Last Synced: 2025-01-16T00:24:43.458Z (6 months ago)
- Language: Go
- Size: 1000 Bytes
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# http-p2s
Narrow the HTTP request traffic with a middleware## Usage
```go
package mainimport (
p2s "github.com/rosbit/http-p2s"
"github.com/urfave/negroni"
"net/http"
"fmt"
)func main() {
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, "Welcome to the home page!")
})n := negroni.New()
n.UseFunc(p2s.NarrowHttpRequest(5)) // use this middleware before other middleware
n.UseHandler(mux)
http.ListenAndServe(":8080", n)
}
```## Status
The package is fully tested.## Contribution
Pull requests are welcome! Also, if you want to discuss something send a pull request with proposal and changes.