2018-05-21 10:02:24 +00:00
|
|
|
package gfw
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Launch listens and binds the server to the given port
|
|
|
|
func (s *Server) Launch(port uint16) error {
|
|
|
|
|
|
|
|
/* (1) Bind router */
|
2018-05-21 11:02:15 +00:00
|
|
|
http.HandleFunc("/", s.route)
|
2018-05-21 10:02:24 +00:00
|
|
|
|
|
|
|
/* (2) Bind listener */
|
|
|
|
return http.ListenAndServe(fmt.Sprintf(":%d", port), nil)
|
|
|
|
|
|
|
|
}
|