package switchcounter import ( "net/http" r "gopkg.in/rethinkdb/rethinkdb-go.v6" ) type Switches struct { session *r.Session } func New(session *r.Session, mux *http.ServeMux) *Switches { result := &Switches{ session: session, } mux.HandleFunc("/switches/id/", result.GetID) mux.HandleFunc("/switches/", result.GetSwitches) mux.HandleFunc("/switches/current", result.Current) mux.HandleFunc("/switches/switch", result.RegisterSwitch) return result }