Add: Template Config options & comments;
This commit is contained in:
@@ -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())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user