diff --git a/router.go b/router.go index 7b50138..584ba01 100644 --- a/router.go +++ b/router.go @@ -102,6 +102,7 @@ func (r *Router) Start(addr string) error { return r.server.ListenAndServe() } +// StartTLS starts a TLS web server using the given key, cert and config and binds to the given address func (r *Router) StartTLS(addr, certFile, keyFile string, conf *tls.Config) error { httpr := r.getHttpr() @@ -115,7 +116,7 @@ func (r *Router) Stop() error { return nil } - ctx, cancel := context.WithTimeout(context.Background(), time.Duration(time.Second*5)) + ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) defer cancel() err := r.server.Shutdown(ctx) if err == context.DeadlineExceeded { @@ -211,7 +212,7 @@ func handleReq(r *Router, handle Handle, m []Middleware) httprouter.Handle { c := newContext(r, res, req, param) f := handle - for i := len(m) - 1; i >= 0; i-- { // TODO: 1,2,3 of 3,2,1 + for i := len(m) - 1; i >= 0; i-- { f = m[i](f) }