Files
asset_assistant/backend/user/src/main.go
2025-11-11 14:34:23 +08:00

34 lines
721 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 (
"user/db"
"user/logger"
"user/logic"
"github.com/gin-gonic/gin"
_ "github.com/lib/pq"
"go.uber.org/zap"
)
func main() {
logger.Init()
zap.L().Info("🚀 用户服务初始化")
zap.L().Info("⌛️ 数据库初始化开始")
db.Init()
zap.L().Info("✅ 数据库初始化成功")
gin.SetMode(gin.ReleaseMode)
r := gin.Default()
// 登录接口
r.POST("/user/login", logic.LoginHandler)
zap.L().Info("✅ 登录接口注册完成: POST /user/login")
// 注册接口
r.POST("/user/register", logic.RegisterHandler)
zap.L().Info("✅ 登录接口注册完成: POST /user/register")
// 启动服务监听80端口
zap.L().Info("✅ 服务启动在80端口")
r.Run(":80")
}