refactor httpd
This commit is contained in:
parent
7c17c971a0
commit
515e910683
2 changed files with 6 additions and 6 deletions
|
@ -13,10 +13,11 @@ import (
|
|||
"gopkg.in/mcuadros/go-syslog.v2/format"
|
||||
)
|
||||
|
||||
// TODO: return a server
|
||||
func setupHTTP(hub circolog.Hub) {
|
||||
http.HandleFunc("/", getHTTPHandler(hub))
|
||||
http.HandleFunc("/ws", getWSHandler(hub))
|
||||
func setupHTTP(hub circolog.Hub) *http.ServeMux {
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/", getHTTPHandler(hub))
|
||||
mux.HandleFunc("/ws", getWSHandler(hub))
|
||||
return mux
|
||||
}
|
||||
|
||||
func parseParameterL(r *http.Request) (int, error) {
|
|
@ -59,8 +59,7 @@ func main() {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
setupHTTP(hub)
|
||||
httpServer := http.Server{Handler: nil}
|
||||
httpServer := http.Server{Handler: setupHTTP(hub)}
|
||||
if *querySocket != "" {
|
||||
fmt.Printf("Binding address `%s` [http]\n", *querySocket)
|
||||
unixListener, err := net.Listen("unix", *querySocket)
|
||||
|
|
Loading…
Reference in a new issue