Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rosbit/http-p2s
a middleware to narrow the HTTP request traffic
https://github.com/rosbit/http-p2s
Last synced: about 6 hours 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 (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-27T07:38:59.000Z (about 5 years ago)
- Last Synced: 2024-06-20T17:54:35.707Z (5 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.