2,187
社区成员
发帖
与我相关
我的任务
分享
func main() {
r:=gin.Default();
//r.LoadHTMLGlob("2017/0221/shubuluoke/PC/*")
//r.LoadHTMLFiles("2017/0221/shubuluoke/PC/*");
//r.LoadHTMLGlob("./2017/0221/shubuluoke/PC/*");
//r.StaticFS("/more_static", http.Dir("2017/0221/shubuluoke/PC/"))
//fmt.Println(http.Request.RequestURI);
//siteName:="shubuluoke";
//这静态文件 shubuluoke 站点名名 "./2017/0221/shubuluoke/PC/" 站点路径 我的的方法是监控请求 来动态对这二个进行传值
r.Static("/shubuluoke", "./2017/0221/shubuluoke/PC/");
r.StaticFile("/bootstrap/bootstrap.min.css", "./bootstrap/css/bootstrap.min.css");
r.StaticFile("/bootstrap/bootstrap.min.js", "./bootstrap/js/bootstrap.min.js");
r.GET("/ping",func(c *gin.Context){
c.JSON(200,gin.H{
"message":"pong",
});
});
r.GET("/",func(c *gin.Context){
fmt.Println("Abin_"+c.Request.RequestURI)
});
r.Run(":8000");
}