-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
53 lines (46 loc) · 1.03 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
package main
import (
"fmt"
"lhc.go.crawler/confs"
"lhc.go.crawler/controller/corn"
"lhc.go.crawler/libs/mysql"
"lhc.go.crawler/libs/es"
"lhc.go.crawler/router"
"lhc.go.crawler/logs"
)
func main() {
fmt.Println("加载日志组件.....")
if err:=logs.InitLogs();err!=nil {
logs.Fatal.Fatal(err)
fmt.Println(err)
}
logs.Error.Info("log init")
//加载配置
fmt.Println("加载配置组件.....")
if err := confs.InitConfs();err!=nil{
logs.Fatal.Fatal(err)
fmt.Println(err)
}
//加载mysql连接
fmt.Println("加载mysql连接组件.....")
if err := mysql.InitMysql();err != nil {
logs.Fatal.Fatal(err)
fmt.Println(err)
}
defer mysql.MysqlConnet.Close()
//加载mysql连接
fmt.Println("加载es连接组件.....")
if err := es.InitEs();err != nil {
logs.Fatal.Fatal(err)
fmt.Println(err)
}
//启动定时任务
go corn.InitCornRouter()
//加载路由
fmt.Println("加载路由组件.....")
r := router.InitRouter()
if err := r.Run(":8080");err!=nil{
logs.Fatal.Fatal(err)
fmt.Println(err)
}
}