-
Notifications
You must be signed in to change notification settings - Fork 1
/
routes.go
33 lines (26 loc) · 973 Bytes
/
routes.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
package main
import (
"net/http"
"github.com/hoernschen/goat/handler"
"github.com/hoernschen/goat/handler/signaling"
)
type Route struct {
Name string
Method string
Pattern string
HandlerFunc http.HandlerFunc
}
type Routes []Route
var routes = Routes{
Route{"WebSocket Connection", "GET", "/r/{room}", signaling.WSConnection},
Route{"GetUsers", "GET", "/users", handler.GetUsers},
Route{"GetUser", "GET", "/users/{id}", handler.GetUser},
Route{"CreateUser", "POST", "/users", handler.CreateUser},
Route{"DeleteUser", "DELETE", "/users/{id}", handler.DeleteUser},
Route{"GetRooms", "GET", "/rooms", handler.GetRooms},
Route{"GetRoom", "GET", "/rooms/{id}", handler.GetRoom},
Route{"CreateRoom", "POST", "/rooms", handler.CreateRoom},
Route{"JoinRoom", "PUT", "/rooms/{id}/join", handler.JoinRoom},
Route{"LeaveRoom", "PUT", "/rooms/{id}/leave", handler.LeaveRoom},
Route{"DeleteRoom", "DELETE", "/rooms/{id}", handler.DeleteRoom},
}