schangxiang@126.com
2025-05-07 cace264ad9d86a7831099810b079da1141957add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package main
 
import (
    "app/routes"
    "os"
 
    "github.com/gin-gonic/gin"
)
 
func main() {
    env := os.Getenv("ENV")
    if env == "production" {
        gin.SetMode(gin.ReleaseMode) // 生产环境
    } else {
        gin.SetMode(gin.DebugMode) // 开发环境
    }
    r := gin.Default()
    // 注册路由
    routes.RegisterRoutes(r)
 
    // 运行服务器
    r.Run(":8800")
}