From 07ff0e6a97f5df792dcb60e33390a4e6424d7145 Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Sun, 29 Jun 2025 13:41:48 -0400 Subject: [PATCH] Tell air to not watch public, then tell Fiber to not cache public so I can reload it. --- .air.toml | 2 +- main.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.air.toml b/.air.toml index dc36096..6e01f7b 100644 --- a/.air.toml +++ b/.air.toml @@ -7,7 +7,7 @@ tmp_dir = "tmp" bin = "webapp" cmd = "make build" delay = 1000 - exclude_dir = ["assets", "tmp", "vendor", "testdata"] + exclude_dir = ["assets", "public", "tmp", "vendor", "testdata"] exclude_file = [] exclude_regex = ["_test.go"] exclude_unchanged = false diff --git a/main.go b/main.go index a4d0c27..06ff061 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main import ( "log" "os" + "time" "os/signal" "syscall" "github.com/gofiber/fiber/v2" @@ -32,7 +33,10 @@ func main() { api.Setup(app) data.Setup("sqlite3", "db.sqlite3") - app.Static("/", "./public") + app.Static("/", "./public", fiber.Static{ + Compress: true, + CacheDuration: 1 * time.Nanosecond, + }) // this sets up graceful shutdown go func() {