https://github.com/rosbit/http-p2s
a middleware to narrow the HTTP request traffic
https://github.com/rosbit/http-p2s
Last synced: 3 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 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-27T07:38:59.000Z (almost 7 years ago)
- Last Synced: 2025-03-05T11:16:48.600Z (over 1 year 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 main
import (
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.