zs
2025-04-30 6531b52f50f7dc94ac9136d4eb1d3ecec765516e
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")
}