mirror of https://github.com/gin-gonic/gin.git
Solve #164
This commit is contained in:
parent
8622148fd0
commit
7aa51dc393
10
gin.go
10
gin.go
|
@ -126,16 +126,18 @@ func (engine *Engine) ServeHTTP(writer http.ResponseWriter, request *http.Reques
|
|||
engine.router.ServeHTTP(writer, request)
|
||||
}
|
||||
|
||||
func (engine *Engine) Run(addr string) {
|
||||
func (engine *Engine) Run(addr string) error {
|
||||
debugPrint("Listening and serving HTTP on %s", addr)
|
||||
if err := http.ListenAndServe(addr, engine); err != nil {
|
||||
panic(err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (engine *Engine) RunTLS(addr string, cert string, key string) {
|
||||
func (engine *Engine) RunTLS(addr string, cert string, key string) error {
|
||||
debugPrint("Listening and serving HTTPS on %s", addr)
|
||||
if err := http.ListenAndServeTLS(addr, cert, key, engine); err != nil {
|
||||
panic(err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue