25 lines
468 B
Go
25 lines
468 B
Go
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
|
|
}
|