summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2016-12-06 18:17:24 -0800
committerSteve Manuel <nilslice@gmail.com>2016-12-06 18:17:24 -0800
commitc99dcd123e886e7c62c913074c5c04ae3acc3272 (patch)
tree819b37442e175bdd58b86cbb3aa5de080c6e5ec5 /system
parent2cf6e8d011f61ba1d6386620ba1e0f6c5a097190 (diff)
re-order middleware so Record is called even if cache is active
Diffstat (limited to 'system')
-rw-r--r--system/admin/server.go3
-rw-r--r--system/api/server.go8
2 files changed, 6 insertions, 5 deletions
diff --git a/system/admin/server.go b/system/admin/server.go
index 3568818..bc6f4d6 100644
--- a/system/admin/server.go
+++ b/system/admin/server.go
@@ -7,6 +7,7 @@ import (
"path/filepath"
"github.com/bosssauce/ponzu/system/admin/user"
+ "github.com/bosssauce/ponzu/system/api"
"github.com/bosssauce/ponzu/system/db"
)
@@ -48,5 +49,5 @@ func Run() {
// even if the API server is not running. Otherwise, images/files uploaded
// through the editor will not load within the admin system.
uploadsDir := filepath.Join(pwd, "uploads")
- http.Handle("/api/uploads/", db.CacheControl(http.StripPrefix("/api/uploads/", http.FileServer(restrict(http.Dir(uploadsDir))))))
+ http.Handle("/api/uploads/", api.Record(db.CacheControl(http.StripPrefix("/api/uploads/", http.FileServer(restrict(http.Dir(uploadsDir)))))))
}
diff --git a/system/api/server.go b/system/api/server.go
index 41d652a..703a906 100644
--- a/system/api/server.go
+++ b/system/api/server.go
@@ -8,11 +8,11 @@ import (
// Run adds Handlers to default http listener for API
func Run() {
- http.HandleFunc("/api/types", db.CacheControl(CORS(Record(typesHandler))))
+ http.HandleFunc("/api/types", Record(db.CacheControl(CORS(typesHandler))))
- http.HandleFunc("/api/contents", db.CacheControl(CORS(Record(contentsHandler))))
+ http.HandleFunc("/api/contents", Record(db.CacheControl(CORS(contentsHandler))))
- http.HandleFunc("/api/content", db.CacheControl(CORS(Record(contentHandler))))
+ http.HandleFunc("/api/content", Record(db.CacheControl(CORS(contentHandler))))
- http.HandleFunc("/api/content/external", db.CacheControl(CORS(Record(externalContentHandler))))
+ http.HandleFunc("/api/content/external", Record(db.CacheControl(CORS(externalContentHandler))))
}