Files
narco/router.go
2015-08-26 14:08:18 +02:00

20 lines
535 B
Go

package narco
import (
"net/http"
"github.com/codemodus/chain"
"github.com/julienschmidt/httprouter"
"golang.org/x/net/context"
)
type HandlerFunc func(ctx context.Context, rw http.ResponseWriter, req *http.Request, ps httprouter.Params)
func EndChain(chain chain.Chain, h HandlerFunc) httprouter.Handle {
return func(rw http.ResponseWriter, req *http.Request, ps httprouter.Params) {
chain.EndFn(func(ctx context.Context, rw_ http.ResponseWriter, req_ *http.Request) {
h(ctx, rw_, req_, ps)
}).ServeHTTP(rw, req)
}
}