aboutsummaryrefslogtreecommitdiffhomepage
path: root/middlewares/cache.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-02-07 11:23:23 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-02-07 11:23:23 +0100
commit9f10b2928df655c3672d9607e864e667d4bc903a (patch)
tree7743911b974b3a7fb0d4c7cec2a723942466b7f1 /middlewares/cache.js
parentd7c01e7793d813d804a3b5716d8288f9dcf71a16 (diff)
downloadPeerTube-9f10b2928df655c3672d9607e864e667d4bc903a.tar.gz
PeerTube-9f10b2928df655c3672d9607e864e667d4bc903a.tar.zst
PeerTube-9f10b2928df655c3672d9607e864e667d4bc903a.zip
Remove useless anonymous functions of files
Diffstat (limited to 'middlewares/cache.js')
-rw-r--r--middlewares/cache.js36
1 files changed, 17 insertions, 19 deletions
diff --git a/middlewares/cache.js b/middlewares/cache.js
index 782165155..0d3da0075 100644
--- a/middlewares/cache.js
+++ b/middlewares/cache.js
@@ -1,25 +1,23 @@
1;(function () { 1'use strict'
2 'use strict'
3 2
4 var cacheMiddleware = { 3var cacheMiddleware = {
5 cache: cache 4 cache: cache
6 } 5}
7
8 function cache (cache) {
9 return function (req, res, next) {
10 // If we want explicitly a cache
11 // Or if we don't specify if we want a cache or no and we are in production
12 if (cache === true || (cache !== false && process.env.NODE_ENV === 'production')) {
13 res.setHeader('Cache-Control', 'public')
14 } else {
15 res.setHeader('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate')
16 }
17 6
18 next() 7function cache (cache) {
8 return function (req, res, next) {
9 // If we want explicitly a cache
10 // Or if we don't specify if we want a cache or no and we are in production
11 if (cache === true || (cache !== false && process.env.NODE_ENV === 'production')) {
12 res.setHeader('Cache-Control', 'public')
13 } else {
14 res.setHeader('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate')
19 } 15 }
16
17 next()
20 } 18 }
19}
21 20
22 // --------------------------------------------------------------------------- 21// ---------------------------------------------------------------------------
23 22
24 module.exports = cacheMiddleware 23module.exports = cacheMiddleware
25})()