package main
import (
"net/http"
"github.com/gin-gonic/gin"
)
func main() {
app := gin.Default()
app.GET("/user.json", func(c *gin.Context) {
c.Header("Content-Type", "application/json")
c.Header("Access-Control-Allow-Origin", "*")
c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE")
c.Header("Access-Control-Allow-Headers", "Action, Module, X-PINGOTHER, Content-Type, Content-Disposition")
app.LoadHTMLGlob("./data/*") // 静态资源所属文件夹
c.HTML(http.StatusOK, "user.json", nil) // 文件名 user.json
})
//
app.Run(":80") // Run("里面不指定端口号默认为8080")
}