-
Notifications
You must be signed in to change notification settings - Fork 26
/
main.go
34 lines (27 loc) · 807 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
r "github.com/dancannon/gorethink"
"log"
"net/http"
)
func main() {
session, err := r.Connect(r.ConnectOpts{
Address: "localhost:28015",
Database: "rtsupport",
})
if err != nil {
log.Panic(err.Error())
}
router := NewRouter(session)
router.Handle("channel add", addChannel)
router.Handle("channel subscribe", subscribeChannel)
router.Handle("channel unsubscribe", unsubscribeChannel)
router.Handle("user edit", editUser)
router.Handle("user subscribe", subscribeUser)
router.Handle("user unsubscribe", unsubscribeUser)
router.Handle("message add", addChannelMessage)
router.Handle("message subscribe", subscribeChannelMessage)
router.Handle("message unsubscribe", unsubscribeChannelMessage)
http.Handle("/", router)
http.ListenAndServe(":4000", nil)
}