forked from imyuliz/longweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.go
41 lines (31 loc) · 832 Bytes
/
server.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
package httpserver
import (
"github.com/devfeel/dotweb"
"github.com/devfeel/longweb/config"
"github.com/devfeel/longweb/framework/log"
"github.com/devfeel/longweb/message"
"strconv"
)
func StartServer() error {
//初始化DotServer
app := dotweb.New()
//设置dotserver日志目录
app.SetLogPath(config.CurrentConfig.Log.FilePath)
app.SetEnabledLog(true)
app.UseRequestLog()
//设置路由
InitRoute(app)
innerLogger := logger.GetInnerLogger()
//启动监控服务
pprofport := config.CurrentConfig.HttpServer.PProfPort
app.SetPProfConfig(true, pprofport)
// 开始服务
port := config.CurrentConfig.HttpServer.HttpPort
innerLogger.Debug("dotweb.StartServer => " + strconv.Itoa(port))
err := app.StartServer(port)
return err
}
func ReSetServer() {
//初始化应用信息
message.InitAppInfo()
}