v2-1a949bacb88429abb613451767bdce3e.jpg

package main

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

func main()  {
    // 初始化
    router := gin.New();
    router.POST("/:name/*attr", func(context *gin.Context) {
        context.String(200,
            "path param name:%s attr:%s id:%s type:%s",
            context.Param("name"),
            context.Param("attr"),
            context.Query("id"),
            context.PostForm("type"))
    })
    // 启动服务
    router.Run(":8080")
}