main.go 659 Bytes
Newer Older
chenweijian's avatar
chenweijian committed
1 2 3 4
package main

import (
	"fmt"
hujiebin's avatar
hujiebin committed
5
	"git.hilo.cn/hilo-common/resource/consul"
hujiebin's avatar
hujiebin committed
6
	"hilo-user/cron"
hujiebin's avatar
hujiebin committed
7
	"hilo-user/domain/service/event_s"
chenweijian's avatar
chenweijian committed
8 9 10 11
	"hilo-user/route"
)

const (
hujiebin's avatar
hujiebin committed
12 13 14
	PORT         = 9040
	RegisterName = "hiloUser"
	RegisterTag  = "用户中心"
chenweijian's avatar
chenweijian committed
15 16 17
)

func main() {
hujiebin's avatar
hujiebin committed
18
	cron.Init()                                              // 开启定时任务
hujiebin's avatar
hujiebin committed
19
	event_s.EventInit()                                      // 注册事件(内部事件+mysql拟kafka)
hujiebin's avatar
hujiebin committed
20 21 22
	r := route.InitRouter()                                  // 注册路由
	consul.RegisterToConsul(PORT, RegisterName, RegisterTag) // 服务注册
	r.Run(fmt.Sprintf(":%d", PORT))                          // 启动服务
chenweijian's avatar
chenweijian committed
23
}