Skip to content

Commit

Permalink
fix(fiber): Fix assets not being served using the embedded file syste…
Browse files Browse the repository at this point in the history
…m. (#265)
  • Loading branch information
mubashiroliyantakath committed Jul 8, 2024
1 parent fef23e3 commit a2ee125
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cmd/template/advanced/files/htmx/imports/fiber.tmpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"github.com/a-h/templ"
"{{.ProjectName}}/cmd/web"
"github.com/gofiber/fiber/v2/middleware/adaptor"
"github.com/gofiber/fiber/v2/middleware/adaptor"
"github.com/gofiber/fiber/v2/middleware/filesystem"
"net/http"
6 changes: 5 additions & 1 deletion cmd/template/advanced/files/htmx/routes/fiber.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
s.App.Static("/assets", "./cmd/web/assets")
s.App.Use("/assets", filesystem.New(filesystem.Config{
Root: http.FS(web.Files),
PathPrefix: "assets",
Browse: false,
}))

s.App.Get("/web", adaptor.HTTPHandler(templ.Handler(web.HelloForm())))

Expand Down

0 comments on commit a2ee125

Please sign in to comment.