初始化Go学习项目

This commit is contained in:
liumangmang
2025-12-26 17:56:02 +08:00
commit 7f4527d501
90 changed files with 3436 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
package main
import (
"github.com/gin-gonic/gin"
)
func main() {
r := gin.Default()
r.POST("/login", func(c *gin.Context) {
username := c.PostForm("username") // 获取表单参数
password := c.PostForm("password")
// 简单验证
if username == "" || password == "" {
c.JSON(400, gin.H{"error": "username and password required"})
return
}
c.JSON(200, gin.H{
"message": "Login successful",
"username": username,
})
})
r.Run(":8080")
}