diff --git a/internal/server/control/control.go b/internal/server/control/control.go new file mode 100644 index 0000000..668bccf --- /dev/null +++ b/internal/server/control/control.go @@ -0,0 +1,35 @@ +package control + +import ( + "net/http" + + "github.com/gorilla/mux" +) + +type ControlServer struct { + bindAddr string + ctrlMux *mux.Router +} + +var Server *ControlServer + +func (srv *ControlServer) Run(bindAddr string) { + + Server = &ControlServer{bindAddr, mux.NewRouter()} + + Server.ctrlMux.HandleFunc("/routes/{id}", Server.removeRoute).Methods("DELETE") + Server.ctrlMux.HandleFunc("/routes", Server.listRoutes).Methods("GET") + Server.ctrlMux.HandleFunc("/routes", Server.addRoute).Methods("POST") +} + +func (srv *ControlServer) removeRoute(http.ResponseWriter, *http.Request) { + +} + +func (srv *ControlServer) listRoutes(http.ResponseWriter, *http.Request) { + +} + +func (srv *ControlServer) addRoute(http.ResponseWriter, *http.Request) { + +} diff --git a/internal/server/control/control_test.go b/internal/server/control/control_test.go new file mode 100644 index 0000000..adf0cc5 --- /dev/null +++ b/internal/server/control/control_test.go @@ -0,0 +1,9 @@ +package control_test + +import ( + "testing" +) + +func TestNewControlServerFillsTheStructCorrectly(t *testing.T) { + +}