本文整理匯總了Golang中github.com/labstack/echo.Echo.Static方法的典型用法代碼示例。如果您正苦於以下問題:Golang Echo.Static方法的具體用法?Golang Echo.Static怎麽用?Golang Echo.Static使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/labstack/echo.Echo
的用法示例。
在下文中一共展示了Echo.Static方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Init
func Init(e *echo.Echo) {
const (
indexPath string = "public/views/index.html"
faviconPath string = "public/favicon.ico"
templatePath string = "public/views"
staticPath string = "public/static"
)
e.Index(indexPath)
e.Favicon(faviconPath)
e.Static("/static", staticPath)
initTemplate(e, templatePath)
}
示例2: serveStatic
func serveStatic(e *echo.Echo) {
for prefix, rootConf := range staticFileMap {
filterPrefixs = append(filterPrefixs, prefix)
if rootConf.isFile {
e.File(prefix, ROOT+rootConf.root)
} else {
e.Static(prefix, ROOT+rootConf.root)
}
}
}
示例3: Set
func Set(e *echo.Echo) *echo.Echo {
e.Favicon("static/favicon.ico")
e.Static("/", "static")
e.Get("/", controller.Index)
e.Get("/eval/", controller.Eval)
e.Post("/eval/", controller.PostEval)
return e
}
示例4: Setup
// Setup theme
func Setup(e *echo.Echo, mode string) {
var t Template
if mode == "dev" {
// development
t.templates = template.Must(template.ParseGlob("internals/themes/" + Theme + "/*.html"))
e.Static("/assets", "internals/themes/"+Theme+"/assets")
e.File("/favicon.ico", "internals/themes/"+Theme+"favicon.ico")
} else {
// production
t.templates = template.Must(template.ParseGlob("public/themes/" + Theme + "/*.html"))
e.Static("/assets", "public/themes/"+Theme+"/assets")
e.File("/favicon.ico", "public/themes/"+Theme+"favicon.ico")
}
e.SetRenderer(&t)
}
示例5: route
// route will establish routes
func route(e *echo.Echo) {
e.Static("/", "static")
//api := e.Group("/api")
}