Skip to content

v0.10.0

Choose a tag to compare

@ryanhamamura ryanhamamura released this 06 Feb 23:22
· 43 commits to main since this release

Static file serving

New one-liner helpers for serving static files:

  • v.Static(urlPrefix, dir) — serves files from a filesystem directory
  • v.StaticFS(urlPrefix, fsys) — serves files from an fs.FS (works with //go:embed)

Both methods auto-normalize the URL prefix and disable directory listings.

// Filesystem directory
v.Static("/assets/", "./public")

// Embedded files
//go:embed static
var staticFiles embed.FS
v.StaticFS("/assets/", staticFiles)