Moved app consts to config package.

This commit is contained in:
mikestefanello 2021-12-10 08:33:49 -05:00
parent 959eeda35f
commit 590910bc41
3 changed files with 11 additions and 19 deletions

View file

@ -3,6 +3,7 @@ package controllers
import (
"net/http"
"goweb/config"
"goweb/middleware"
"github.com/gorilla/sessions"
@ -14,17 +15,12 @@ import (
"goweb/container"
)
const (
StaticDir = "static"
StaticPrefix = "files"
)
func BuildRouter(c *container.Container) {
// Static files with proper cache control
// funcmap.File() should be used in templates to append a cache key to the URL in order to break cache
// after each server restart
c.Web.Group("", middleware.CacheControl(c.Config.Cache.MaxAge.StaticFile)).
Static(StaticPrefix, StaticDir)
Static(config.StaticPrefix, config.StaticDir)
// Middleware
g := c.Web.Group("",