Files
dypid/main.go
T
ygxbnet 1505226628
部署开发环境 / deploy-dev (push) Successful in 2m0s
refactor(后端): 删除gin请求日志,优化代码路径
2026-06-03 13:02:40 +08:00

41 lines
786 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package main
import (
"dypid/internal/config"
"dypid/internal/db"
"dypid/internal/service"
"embed"
"fmt"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
)
//go:embed web/dist/*
var webFiles embed.FS
func main() {
config.InitConfig()
db.InitRedis()
db.InitLocalDB()
//初始化一个http服务对象
gin.SetMode(config.APPConfig.RunMode)
r := gin.New()
r.Use(gin.Recovery())
r.Use(cors.Default()) //跨域设置
//注册网页服务(Vue
service.RegWebService(r, webFiles)
//注册API接口
service.RegAPIService(r)
// 监听并在 0.0.0.0:8080 上启动服务
fmt.Printf("服务器正在运行:http://%s\n", config.APPConfig.Host)
err := r.Run(config.APPConfig.Host)
if err != nil {
fmt.Println("服务启动失败:", err)
return
}
}