Add: Template Config options & comments;

This commit is contained in:
$(pass /github/name)
2024-07-18 12:25:51 +02:00
parent f4a9166bee
commit 602ac0fef0
5 changed files with 46 additions and 42 deletions

View File

@@ -1,7 +1,11 @@
// Package server initializes and runs the application server.
// It sets up configurations, initializes the database, services, and controllers,
// loads HTML templates, and starts the HTTP server.
package server
import (
"net/http"
"path/filepath"
"GoMembership/internal/config"
"GoMembership/internal/controllers"
@@ -16,6 +20,7 @@ import (
"github.com/gin-gonic/gin"
)
// Run initializes the server configuration, sets up services and controllers, and starts the HTTP server.
func Run() {
config.LoadConfig()
logger.Info.Printf("Config loaded: %#v", config.CFG)
@@ -44,9 +49,9 @@ func Run() {
router := gin.Default()
// gin.SetMode(gin.ReleaseMode)
router.Static("/templates/css", "./style")
router.Static(config.Templates.StaticPath, "./style")
// Load HTML templates
router.LoadHTMLGlob("templates/html/*")
router.LoadHTMLGlob(filepath.Join(config.Templates.HTMLPath, "*"))
router.Use(gin.Logger())
// router.Use(middlewares.LoggerMiddleware())