Skip to main content

Static

Zinc already has app-level static helpers. Static is the middleware-shaped version for stacks that prefer app.Use(...).

app.Use(middleware.Static("./public"))

Serve from a prefix:

app.Use(middleware.StaticFrom("/assets", "./public"))

Serve from an fs.FS:

app.Use(middleware.StaticFS(embeddedFiles))

By default, Static falls through to the next handler when a file is not found.

app.Use(middleware.StaticWithConfig(middleware.StaticConfig{
Root: "./public",
Prefix: "/assets",
NextOnNotFound: true,
}))