Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
alice
✓ github.com/containous/alice
Chain HTTP middleware handlers
package main
import (
"net/http"
"github.com/containous/alice"
)
func myHandler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello"))
}
func main() {
chain := alice.New(
func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("X-Custom", "value")
next.ServeHTTP(w, r)
})
},
).Then(http.HandlerFunc(myHandler))
http.ListenAndServe(":8080", chain)
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
0.0.0-20181107144136-d83ebdd94cbdlatest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.