element/server/router.go
Evan Hazlett 1dd748e3f2
wip: service registration
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-07-30 04:13:44 -04:00

18 lines
635 B
Go

package server
import "github.com/gorilla/mux"
func (s *Server) router() *mux.Router {
r := mux.NewRouter()
r.HandleFunc("/", s.genericHandler)
r.HandleFunc("/config", s.getConfig).Methods("GET")
r.HandleFunc("/config/raw", s.getConfigRaw).Methods("GET")
r.HandleFunc("/frontends", s.addFrontend).Methods("POST")
r.HandleFunc("/frontends", s.updateFrontend).Methods("PUT")
r.HandleFunc("/frontends/{name}", s.removeFrontend).Methods("DELETE")
r.HandleFunc("/services", s.registerService).Methods("POST")
r.HandleFunc("/services", s.getServices).Methods("GET")
r.HandleFunc("/reload", s.reload).Methods("POST")
return r
}