Assemble HTTP middleware functions to a http.Handler which processes the request in chained middleware order.
package main
import (
"net/http"
"github.com/maxwu/chainer"
)
func main() {
http.Handle("/", chainer.Chain(
chainer.MiddlewareFunc(logger),
chainer.MiddlewareFunc(authenticator),
chainer.MiddlewareFunc(authorizer),
chainer.MiddlewareFunc(handler),
))
http.ListenAndServe(":8080", nil)
}
This project also demonstrates how to use gotest-labels package to select tests by the tags in test case comment block.