Moved app consts to config package.
This commit is contained in:
parent
959eeda35f
commit
590910bc41
3 changed files with 11 additions and 19 deletions
|
|
@ -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("",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue