gin 框架学习笔记(一)

package main

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

func main() {  
    router := gin.Default()
    router.GET("/test", func(context *gin.Context) {
        context.JSON(200, gin.H{
            "msg": "Success!",
        })
    })
    router.Run(":6789")
}

访问localhost:6789/test