-
Notifications
You must be signed in to change notification settings - Fork 0
/
webserver_pro.go
55 lines (47 loc) · 1.07 KB
/
webserver_pro.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
52
53
54
55
// +build pro debug
package main
import (
"fmt"
"net/http"
"strconv"
"github.com/gin-gonic/gin"
)
// wIndex is not for glass, home page handler. Could probably be converted to one function for all 3.
func wIndex(c *gin.Context) {
executeContent(c, "index")
}
// wMatches handles match view.
func wMatches(c *gin.Context) {
if c.Param("match") != "" {
// TODO
matchNum := c.Param("match")
num, err := strconv.Atoi(matchNum)
if err != nil || num < 0 || num >= len(MATCHES) {
fmt.Println(err)
executeContent(c, "matches")
return
}
executeContent(c, "match:"+strconv.Itoa(num))
} else {
executeContent(c, "matches")
}
}
// wRankings handles rankings view.
func wRankings(c *gin.Context) {
executeContent(c, "rankings")
}
func playersAPI(c *gin.Context) {
c.JSON(http.StatusOK, PLAYERSET)
}
func matchesAPI(c *gin.Context) {
c.JSON(http.StatusOK, MATCHES)
}
func scheduleAPI(c *gin.Context) {
c.JSON(http.StatusOK, MasterSchedule)
}
func wSchedule(c *gin.Context) {
executeContent(c, "schedule")
}
func wOBS(c *gin.Context) {
executeContent(c, "obs")
}