Merge branch 'feature_control_server'

This commit is contained in:
Héctor Hurtado
2019-10-08 09:21:27 +02:00
2 changed files with 44 additions and 0 deletions
+35
View File
@@ -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) {
}
+9
View File
@@ -0,0 +1,9 @@
package control_test
import (
"testing"
)
func TestNewControlServerFillsTheStructCorrectly(t *testing.T) {
}