-
Notifications
You must be signed in to change notification settings - Fork 0
/
routing.go
51 lines (37 loc) 路 1.5 KB
/
routing.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package rest
import (
"github.com/boggydigital/nod"
"net/http"
)
var (
Log = nod.RequestLog
)
func HandleFuncs() {
patternHandlers := map[string]http.Handler{
"GET /video": Log(http.HandlerFunc(GetVideo)),
"GET /poster": Log(http.HandlerFunc(GetPoster)),
"GET /captions": Log(http.HandlerFunc(GetCaptions)),
"GET /watch": Log(http.HandlerFunc(GetWatch)),
"GET /listen": Log(http.HandlerFunc(GetListen)),
"GET /manage_video": http.HandlerFunc(GetManageVideo),
"GET /update_video": http.HandlerFunc(GetUpdateVideo),
"GET /video_error": http.HandlerFunc(GetVideoError),
"GET /list": Log(http.HandlerFunc(GetList)),
"GET /paste": Log(http.HandlerFunc(GetPaste)),
"GET /history": Log(http.HandlerFunc(GetHistory)),
"GET /search": Log(http.HandlerFunc(GetSearch)),
"GET /results": Log(http.HandlerFunc(GetResults)),
"POST /progress": Log(http.HandlerFunc(PostProgress)),
"POST /ended": Log(http.HandlerFunc(PostEnded)),
"GET /playlist": Log(http.HandlerFunc(GetPlaylist)),
"GET /refresh_playlist": Log(http.HandlerFunc(GetRefreshPlaylist)),
"GET /manage_playlist": Log(http.HandlerFunc(GetManagePlaylist)),
"GET /update_playlist": Log(http.HandlerFunc(GetUpdatePlaylist)),
"GET /channel": Log(http.HandlerFunc(GetChannel)),
"GET /refresh_channel": Log(http.HandlerFunc(GetRefreshChannel)),
"GET /": Log(http.RedirectHandler("/list", http.StatusPermanentRedirect)),
}
for p, h := range patternHandlers {
http.HandleFunc(p, h.ServeHTTP)
}
}