package main

import (
	"github.com/gin-gonic/gin"
)

func main() {
	r := gin.Default()

	r.GET("/search", func(c *gin.Context) {
		keyword := c.Query("q")                // 获取查询参数
		limit := c.DefaultQuery("limit", "10") // 带默认值
		c.JSON(200, gin.H{
			"keyword": keyword,
			"limit":   limit,
		})
	})

	r.Run(":8080")
}
