1234567891011121314151617181920212223 |
- package server
- import (
- "go-msa-auth/config"
- "go-msa-auth/internal/handlers"
- "go-msa-auth/internal/models"
- "github.com/gin-gonic/gin"
- )
- // InitServer 初始化服务器
- func InitServer() error {
- // 初始化数据库
- models.InitDatabase(config.AppConfig.DBPath)
- // 创建 Gin 实例
- r := gin.Default()
- // 路由配置
- r.POST("/auth", handlers.AuthHandler)
- // 启动服务
- return r.Run(config.AppConfig.ServerPort)
- }
|