-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
38 lines (29 loc) · 766 Bytes
/
Copy pathmain.go
File metadata and controls
38 lines (29 loc) · 766 Bytes
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
package main
import (
"fmt"
"log"
"github.com/xavierror/gin-api/conf"
"github.com/xavierror/gin-api/model"
"github.com/xavierror/gin-api/package/cache"
"github.com/xavierror/gin-api/package/redLock"
"github.com/xavierror/gin-api/package/single"
"github.com/xavierror/gin-api/router"
"github.com/gin-gonic/gin"
)
func init() {
conf.Setup()
cache.Setup()
model.Setup()
single.Setup()
go redLock.Setup()
}
// @title GIN-API
// @version 1.0
// @description 响应码说明: 2xx请求成功,3xx重定向,4xx请求错误,5xx服务器错误
func main() {
gin.SetMode(conf.App.RunMode)
app := router.Setup()
endPoint := fmt.Sprintf(":%d", conf.App.HttpPort)
log.Printf("[info] start http server listening %s", endPoint)
app.Run(endPoint)
}