This commit is contained in:
Fenny 2020-03-15 14:45:57 +01:00
parent 94f4ec5ca1
commit bec9eecb29
3 changed files with 6 additions and 6 deletions

6
app.go
View File

@ -115,8 +115,8 @@ func (app *App) Group(prefix string, handlers ...func(*Ctx)) *Group {
}
}
// StaticConfig represents settings for serving static files
type StaticConfig struct {
// Static represents settings for serving static files
type Static struct {
// Transparently compresses responses if set to true
// This works differently than the github.com/gofiber/compression middleware
// The server tries minimizing CPU usage by caching compressed files.
@ -135,7 +135,7 @@ type StaticConfig struct {
}
// Static : https://fiber.wiki/application#static
func (app *App) Static(prefix, root string, config ...StaticConfig) *App {
func (app *App) Static(prefix, root string, config ...Static) *App {
app.registerStatic(prefix, root, config...)
return app
}

View File

@ -29,9 +29,9 @@ func (grp *Group) Group(prefix string, handlers ...func(*Ctx)) *Group {
}
// Static : https://fiber.wiki/application#static
func (grp *Group) Static(prefix, root string) *Group {
func (grp *Group) Static(prefix, root string, config ...Static) *Group {
prefix = groupPaths(grp.prefix, prefix)
grp.app.registerStatic(prefix, root)
grp.app.registerStatic(prefix, root, config...)
return grp
}

View File

@ -258,7 +258,7 @@ func (app *App) registerWebSocket(method, path string, handle func(*Ctx)) {
})
}
func (app *App) registerStatic(prefix, root string, config ...StaticConfig) {
func (app *App) registerStatic(prefix, root string, config ...Static) {
// Cannot have an empty prefix
if prefix == "" {
prefix = "/"