Listen now returns the server object
This commit is contained in:
@@ -81,7 +81,7 @@ func (router *Router) Static(mount string, filePath string) {
|
|||||||
router.Route(mount, NewStatic(filePath))
|
router.Route(mount, NewStatic(filePath))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (router *Router) Listen(host string, port int) error {
|
func (router *Router) Listen(host string, port int) (*http.Server, error) {
|
||||||
srv := &http.Server{
|
srv := &http.Server{
|
||||||
Addr: fmt.Sprintf("%s:%d", host, port),
|
Addr: fmt.Sprintf("%s:%d", host, port),
|
||||||
ReadTimeout: 5 * time.Second,
|
ReadTimeout: 5 * time.Second,
|
||||||
@@ -90,5 +90,5 @@ func (router *Router) Listen(host string, port int) error {
|
|||||||
Handler: router,
|
Handler: router,
|
||||||
}
|
}
|
||||||
|
|
||||||
return srv.ListenAndServe()
|
return srv, srv.ListenAndServe()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user