Ulteriori aggiunte al prototipo della pagina Appunti Condivisi

This commit is contained in:
2022-08-31 01:22:08 +02:00
parent 8c4ed0b70e
commit 64200cd654
6 changed files with 913 additions and 255 deletions
+4 -2
View File
@@ -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)