-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (33 loc) · 891 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
35
36
37
38
39
package main
import (
"github.com/gin-gonic/gin"
"offlinejudge/controller/contest"
"offlinejudge/controller/participant"
"offlinejudge/controller/status"
"offlinejudge/controller/submission"
"offlinejudge/io"
"offlinejudge/utils"
)
func main() {
r := gin.Default()
participant.Init(r)
submission.Init(r)
status.Init(r)
contest.Init(r)
utils.SaveData = io.Update
io.Init()
r.OPTIONS("/*path", func(c *gin.Context) {
o := c.Request.Header.Get("Origin")
c.Header("Access-Control-Allow-Credentials", "true")
c.Header("Access-Control-Allow-Origin", o)
c.Header("Access-Control-Allow-Methods", "GET, POST, OPTIONS")
c.Header("Access-Control-Allow-Headers", "Content-Type, Authorization")
c.Header("Content-Type", "application/json")
c.String(200, "")
})
err := r.Run(":12138")
if err != nil {
panic(err)
return
}
}