Files
learn-golang/Web开发/01go-gin-demo/main.go
liumangmang b010f82221 feat(auth): 添加完整的用户认证API项目
- 实现用户注册、登录、JWT令牌认证功能
- 集成Gin、GORM、Viper、Zap等框架
- 添加密码加密、数据库操作、中间件等完整功能
- 配置多环境支持、日志轮转、CORS处理
- 创建完整的项目结构和配置文件体系
2025-12-30 18:00:42 +08:00

21 lines
341 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 (
"github.com/gin-gonic/gin"
)
func main() {
// 创建 Gin 引擎(类似 Spring 的 ApplicationContext
r := gin.Default()
// 注册路由和处理器
r.GET("/hello", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "Hello, Gin!",
})
})
// 启动服务器,监听 8080 端口
r.Run(":8080")
}