-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
57 lines (47 loc) · 1.05 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
The data type of all requests is json, and you need set the headers with "application/json"
The data type of all response is json.
eg:
{
"Code": 200,
"Data": {
"Code": 200,
"Data": "msg"
}
}
*/
package main
import (
"DosMq/db/mongo"
"DosMq/db/redis"
"DosMq/mq"
"DosMq/router"
"DosMq/utils"
"flag"
"fmt"
log "github.com/sirupsen/logrus"
"time"
)
func main() {
// time init
loc, _ := time.LoadLocation("Asia/Chongqing")
fmt.Printf("时区: %s\n", loc)
// config init
configName := flag.String("configName", "config", "config file's name.")
configPath := flag.String("configPath", "./config", "config file's path.")
utils.ConfigInit(configName, configPath)
// log init
utils.LogInit()
// db init
redis.Init()
mongo.Init()
// load router
r := router.GetRouter()
log.Info("router loaded……")
// start listen message queue
go mq.StartProcess()
// run server
if err := r.Run(":8080"); err != nil {
log.Error(err)
}
}