Compare commits
1 Commits
master
...
export_han
Author | SHA1 | Date | |
---|---|---|---|
2120b5da8f |
@ -97,7 +97,7 @@ func (r *Router) OPTIONS(path string, handle Handle, middleware ...Middleware) {
|
||||
|
||||
// Start starts the web server and binds to the given address
|
||||
func (r *Router) Start(addr string) error {
|
||||
httpr := r.getHttpr()
|
||||
httpr := r.GetHandler()
|
||||
|
||||
r.server = &http.Server{Addr: addr, Handler: httpr}
|
||||
return r.server.ListenAndServe()
|
||||
@ -105,7 +105,7 @@ func (r *Router) Start(addr string) error {
|
||||
|
||||
// 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()
|
||||
httpr := r.GetHandler()
|
||||
|
||||
r.server = &http.Server{Addr: addr, Handler: httpr, TLSConfig: conf}
|
||||
return r.server.ListenAndServeTLS(certFile, keyFile)
|
||||
@ -128,7 +128,7 @@ func (r *Router) Stop() error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *Router) getHttpr() http.Handler {
|
||||
func (r *Router) GetHandler() http.Handler {
|
||||
httpr := httprouter.New()
|
||||
|
||||
for _, v := range r.routes {
|
||||
@ -232,7 +232,6 @@ func handleReq(r *Router, handle Handle, m []Middleware) httprouter.Handle {
|
||||
}
|
||||
|
||||
err := f(c)
|
||||
|
||||
if err != nil {
|
||||
r.ErrorHandler(c, err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user