Ulteriori aggiunte al prototipo della pagina Appunti Condivisi
This commit is contained in:
+4
-2
@@ -1,6 +1,7 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"git.phc.dm.unipi.it/phc/website/config"
|
||||
@@ -61,14 +62,15 @@ func routes(h handler.Service, r fiber.Router) {
|
||||
|
||||
staticConfig := fiber.Static{}
|
||||
if config.Mode == "development" {
|
||||
log.Printf("Disabling Cache-Control in development mode")
|
||||
|
||||
// if no "Cache-Control" is present the browser will cache heuristically (and we don't want that)
|
||||
r.Use(func(c *fiber.Ctx) error {
|
||||
c.Set("Cache-Control", "no-cache")
|
||||
return c.Next()
|
||||
})
|
||||
|
||||
staticConfig.CacheDuration = -1
|
||||
staticConfig.MaxAge = -1
|
||||
staticConfig.CacheDuration = 1 * time.Millisecond
|
||||
}
|
||||
|
||||
r.Static("/", "./_frontend/out", staticConfig)
|
||||
|
||||
Reference in New Issue
Block a user