Merge branch 'feature_control_server'
This commit is contained in:
@@ -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) {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package control_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewControlServerFillsTheStructCorrectly(t *testing.T) {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user