mirror of
https://github.com/gofiber/fiber.git
synced 2025-05-31 11:52:41 +00:00
v1.8.32
This commit is contained in:
parent
94f4ec5ca1
commit
bec9eecb29
6
app.go
6
app.go
@ -115,8 +115,8 @@ func (app *App) Group(prefix string, handlers ...func(*Ctx)) *Group {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// StaticConfig represents settings for serving static files
|
// Static represents settings for serving static files
|
||||||
type StaticConfig struct {
|
type Static struct {
|
||||||
// Transparently compresses responses if set to true
|
// Transparently compresses responses if set to true
|
||||||
// This works differently than the github.com/gofiber/compression middleware
|
// This works differently than the github.com/gofiber/compression middleware
|
||||||
// The server tries minimizing CPU usage by caching compressed files.
|
// The server tries minimizing CPU usage by caching compressed files.
|
||||||
@ -135,7 +135,7 @@ type StaticConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Static : https://fiber.wiki/application#static
|
// 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...)
|
app.registerStatic(prefix, root, config...)
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
4
group.go
4
group.go
@ -29,9 +29,9 @@ func (grp *Group) Group(prefix string, handlers ...func(*Ctx)) *Group {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Static : https://fiber.wiki/application#static
|
// 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)
|
prefix = groupPaths(grp.prefix, prefix)
|
||||||
grp.app.registerStatic(prefix, root)
|
grp.app.registerStatic(prefix, root, config...)
|
||||||
return grp
|
return grp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
// Cannot have an empty prefix
|
||||||
if prefix == "" {
|
if prefix == "" {
|
||||||
prefix = "/"
|
prefix = "/"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user