mirror of
https://github.com/H0llyW00dzZ/My-RESTAPIs-Boilerplate.git
synced 2025-02-06 09:26:02 +00:00
Enchance Static File serving & Update Git & Docker Ignore (#827)
* Enchance [Route] [Frontend] Static File serving - [+] feat(frontend_routes): enable ByteRange and Compress options for static file serving * Update Git & Docker Ignore - [+] chore: add *.gz files to .dockerignore and .gitignore for cache compression * Update Comment - [+] chore(middleware): add comments about ByteRange enhancing QUIC in static file serving
This commit is contained in:
parent
01c6ef4a31
commit
74e540794c
@ -71,3 +71,13 @@ gts-RootCA.pem
|
||||
tailwind.css
|
||||
# Go CSS Generator (not available yet).
|
||||
tailwind.go
|
||||
|
||||
# Cache Compression (gzip)
|
||||
#
|
||||
# Note: When using the Cache Middleware with the WithCacheControl option set to true and a Storage provider (e.g., Redis or Valkey),
|
||||
# the compressed files will be automatically stored in the specified Storage provider and sent to the client (browser).
|
||||
# The compressed files are not stored in the server's memory.
|
||||
#
|
||||
# However, if the WithCacheControl option is set to false, the compressed files will be stored in the server's memory.
|
||||
# In this case, it is recommended to implement a storage mechanism that stores the files on disk instead of memory to avoid excessive memory consumption.
|
||||
*.gz
|
||||
|
10
.gitignore
vendored
10
.gitignore
vendored
@ -94,3 +94,13 @@ gts-RootCA.pem
|
||||
tailwind.css
|
||||
# Go CSS Generator (not available yet).
|
||||
tailwind.go
|
||||
|
||||
# Cache Compression (gzip)
|
||||
#
|
||||
# Note: When using the Cache Middleware with the WithCacheControl option set to true and a Storage provider (e.g., Redis or Valkey),
|
||||
# the compressed files will be automatically stored in the specified Storage provider and sent to the client (browser).
|
||||
# The compressed files are not stored in the server's memory.
|
||||
#
|
||||
# However, if the WithCacheControl option is set to false, the compressed files will be stored in the server's memory.
|
||||
# In this case, it is recommended to implement a storage mechanism that stores the files on disk instead of memory to avoid excessive memory consumption.
|
||||
*.gz
|
||||
|
@ -47,6 +47,9 @@ func registerStaticFrontendRoutes(app *fiber.App, _ string, _ database.Service)
|
||||
// Note: This is an example, and the unused parameters are assigned to "_" to avoid compiler errors.
|
||||
// Register static file serving
|
||||
app.Static("/styles/", "./frontend/public/assets", fiber.Static{
|
||||
// This "ByteRange" Enhance QUIC
|
||||
ByteRange: true,
|
||||
Compress: true,
|
||||
// Note: When running on K8S don't have to compress because it will handled by nginx or other controller.
|
||||
// Compress: true, // Optional
|
||||
// Note: It's important to disable this when using middleware cache to avoid confusion,
|
||||
|
@ -246,6 +246,7 @@ func registerRouteConfigMiddleware(app *fiber.App, db database.Service) {
|
||||
func registerRootRouter(app *fiber.App) {
|
||||
// Register static file serving
|
||||
app.Static("/styles/", "./frontend/public/assets", fiber.Static{
|
||||
// This "ByteRange" Enhance QUIC
|
||||
ByteRange: true,
|
||||
Compress: true,
|
||||
// optional
|
||||
|
Loading…
x
Reference in New Issue
Block a user