feat: serving static files

for example htmx library
in the future tailwindcss out.css file as well
This commit is contained in:
efim
2023-10-06 10:31:50 +00:00
parent a9fce1bcbf
commit bb418101dd
3 changed files with 14 additions and 0 deletions

View File

@@ -16,8 +16,17 @@ import (
//go:embed templates
var templatesFS embed.FS
//go:embed static
var staticFilesFS embed.FS
func AddPageRoutes(app *pocketbase.PocketBase) {
app.OnBeforeServe().Add(getIndexPageRoute(app))
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
e.Router.StaticFS("/static", staticFilesFS)
// this path works : http://127.0.0.1:8090/static/static/public/htmx.min.js
return nil
})
}
// render and return index page