Serve templates and static files from designated directories

This commit is contained in:
Christian Galo 2025-05-07 21:48:51 -05:00
parent b98ec87d8d
commit 64d40bd108

View File

@ -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",