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")
}
