Fixed static file embedding

This commit is contained in:
2025-02-16 17:57:27 +11:00
parent f9e17211ce
commit fafb9b436f
7 changed files with 34 additions and 53 deletions

View File

@@ -15,6 +15,7 @@ func NewServer(
config *config.Config,
logger *zerolog.Logger,
conn *sql.DB,
staticFS *http.FileSystem,
) http.Handler {
mux := http.NewServeMux()
addRoutes(
@@ -22,6 +23,7 @@ func NewServer(
logger,
config,
conn,
staticFS,
)
var handler http.Handler = mux
// Add middleware here, must be added in reverse order of execution
@@ -29,10 +31,6 @@ func NewServer(
handler = middleware.Logging(logger, handler)
handler = middleware.Authentication(logger, config, conn, handler)
// Serve the favicon and exluded files before any middleware is added
handler = middleware.ExcludedFiles(handler)
handler = middleware.Favicon(handler)
// Gzip
handler = middleware.Gzip(handler, config.GZIP)