This commit is contained in:
2024-09-24 13:31:28 +08:00
parent 2bdc5e666b
commit e952657166
17 changed files with 521 additions and 85 deletions

25
router/router.go Normal file
View 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,
}
}