本文整理汇总了Golang中github.com/taironas/route.Router.AddStaticResource方法的典型用法代码示例。如果您正苦于以下问题:Golang Router.AddStaticResource方法的具体用法?Golang Router.AddStaticResource怎么用?Golang Router.AddStaticResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/taironas/route.Router
的用法示例。
在下文中一共展示了Router.AddStaticResource方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
r := new(route.Router)
r.HandleFunc("/squares", squares.Random)
r.HandleFunc("/squares/banner/random", squares.BannerRandom)
r.HandleFunc("/squares/banner/random/gradient", squares.BannerRandomGradient)
r.HandleFunc("/squares/:key", squares.Square) //cached
r.HandleFunc("/isogrids/banner/random", isogrids.BannerRandom)
r.HandleFunc("/isogrids/banner/random/gradient", isogrids.BannerRandomGradient)
r.HandleFunc("/isogrids/:key", isogrids.Isogrids)
r.HandleFunc("/spaceinvaders/:key", spaceinvaders.SpaceInvaders)
r.HandleFunc("/themes/:theme", themes.Theme)
r.HandleFunc("/labs/checkerboard", checkerboard.Checkerboard)
r.HandleFunc("/labs/squares/random", squares.Random)
r.HandleFunc("/labs/isogrids/hexa", isogrids.Hexa)
r.HandleFunc("/labs/isogrids/hexa/:key", isogrids.Hexa)
r.HandleFunc("/labs/isogrids/hexa16/:key", isogrids.Hexa16)
r.HandleFunc("/labs/isogrids/skeleton", isogrids.Skeleton)
r.HandleFunc("/labs/isogrids/diagonals", isogrids.Diagonals)
r.HandleFunc("/labs/isogrids/halfdiagonals", isogrids.HalfDiagonals)
r.HandleFunc("/labs/isogrids/random", isogrids.Random)
r.HandleFunc("/labs/isogrids/random-mirror", isogrids.RandomMirror)
r.HandleFunc("/labs/squares/banner/gradient", squares.BannerGradient)
r.HandleFunc("/labs/isogrids/banner/gradient", isogrids.BannerGradient)
r.AddStaticResource(root)
log.Println("Listening on " + os.Getenv("PORT"))
err := http.ListenAndServe(":"+os.Getenv("PORT"), r)
if err != nil {
log.Fatal("ListenAndServe:", err)
}
}