From 64d40bd1084f1642d5d1ac19ac5e6ef009e53342 Mon Sep 17 00:00:00 2001 From: Christian Galo Date: Wed, 7 May 2025 21:48:51 -0500 Subject: [PATCH] Serve templates and static files from designated directories --- cmd/start.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/start.go b/cmd/start.go index f6a5d67..23f3433 100644 --- a/cmd/start.go +++ b/cmd/start.go @@ -102,8 +102,11 @@ var startCmd = &cobra.Command{ BaseContext: func(_ net.Listener) context.Context { return ctx }, // Pass base context to all requests } - // Serve the components directory - httpRequestRouter.Handle("/", http.FileServer(http.Dir("./components"))) + // Serve the templates and static files + // Serve templates from the "templates" directory + httpRequestRouter.Handle("/", http.FileServer(http.Dir("./templates"))) + // Serve static files from the "static" directory + httpRequestRouter.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("./static")))) // Log server startup with structured logging logger.Info("starting server",