-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (35 loc) · 831 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
40
41
42
43
package main
import (
"log"
"net/http"
"strconv"
"github.com/Depado/jagon-api/conf"
"github.com/Depado/jagon-api/jagon"
"github.com/gin-gonic/gin"
)
const version = "1"
func main() {
var err error
if err = conf.Load("conf.yml"); err != nil {
log.Fatal(err)
}
if !conf.C.Debug {
gin.SetMode(gin.ReleaseMode)
}
r := gin.Default()
r.Static("/static", "./assets")
r.LoadHTMLGlob("./templates/*")
r.GET("/", func(c *gin.Context) {
c.HTML(http.StatusOK, "index.html", gin.H{})
})
apir := r.Group("/api/v" + version)
{
apir.POST("/pray", jagon.Pray)
apir.POST("/praise", jagon.Praise)
apir.POST("/confess", jagon.Confess)
apir.POST("/sacrifice", jagon.DoSacrifice)
apir.GET("/info/prophet", jagon.Prophet)
apir.GET("/info/apostles", jagon.Apostles)
}
r.Run(":" + strconv.Itoa(conf.C.Port))
}