Skip to content

Commit

Permalink
removed / default handler
Browse files Browse the repository at this point in the history
  • Loading branch information
dh1tw committed Apr 2, 2018
1 parent 1809bb3 commit 888cbbb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
4 changes: 0 additions & 4 deletions webserver/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import (
"github.com/gorilla/mux"
)

func IndexHdlr(w http.ResponseWriter, req *http.Request) {
http.ServeFile(w, req, "html/index.html")
}

func (web *WebServer) webSocketHdlr(w http.ResponseWriter, req *http.Request) {

conn, err := upgrader.Upgrade(w, req, nil)
Expand Down
6 changes: 1 addition & 5 deletions webserver/webserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@ func (web *WebServer) Start() {

web.trx.SetNotifyServerChangeCb(web.updateWsClients)

box, err := rice.FindBox("../html")
if err != nil {
log.Fatal("webserver: box not found")
}
box := rice.MustFindBox("../html")

fileServer := http.FileServer(box.HTTPBox())

Expand All @@ -100,7 +97,6 @@ func (web *WebServer) Start() {
router.HandleFunc("/api/server/{server}/active", web.serverActiveHdlr)
router.HandleFunc("/api/server/{server}/state", web.serverStateHdlr)
router.HandleFunc("/ws", web.webSocketHdlr)
router.HandleFunc("/", IndexHdlr)
router.PathPrefix("/").Handler(fileServer)

serverURL := fmt.Sprintf("%s:%d", web.url, web.port)
Expand Down

0 comments on commit 888cbbb

Please sign in to comment.