This commit is contained in:
Javier Provecho Fernandez 2015-01-04 02:23:49 +01:00
parent 8622148fd0
commit 7aa51dc393
1 changed files with 6 additions and 4 deletions

10
gin.go
View File

@ -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
}