优化
This commit is contained in:
25
router/router.go
Normal file
25
router/router.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"api/config"
|
||||
"api/utils"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func InitGlobalVariable() {
|
||||
// 初始化 Viper
|
||||
utils.InitViper()
|
||||
}
|
||||
|
||||
func Server() *http.Server {
|
||||
serverPort := config.Cfg.Server.ServerPort
|
||||
log.Printf("服务启动于 %s 端口", serverPort)
|
||||
return &http.Server{
|
||||
Addr: serverPort,
|
||||
Handler: ServerRouter(),
|
||||
ReadTimeout: 5 * time.Second,
|
||||
WriteTimeout: 10 * time.Second,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user