]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - middlewares/cache.js
Require on the top of the files
[github/Chocobozzz/PeerTube.git] / middlewares / cache.js
index 782165155fda13fe04dff55fe56cdc5037b06c97..0d3da0075ea4570d725a98d9d37459a67da6b3e0 100644 (file)
@@ -1,25 +1,23 @@
-;(function () {
-  'use strict'
+'use strict'
 
-  var cacheMiddleware = {
-    cache: cache
-  }
-
-  function cache (cache) {
-    return function (req, res, next) {
-      // If we want explicitly a cache
-      // Or if we don't specify if we want a cache or no and we are in production
-      if (cache === true || (cache !== false && process.env.NODE_ENV === 'production')) {
-        res.setHeader('Cache-Control', 'public')
-      } else {
-        res.setHeader('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate')
-      }
+var cacheMiddleware = {
+  cache: cache
+}
 
-      next()
+function cache (cache) {
+  return function (req, res, next) {
+    // If we want explicitly a cache
+    // Or if we don't specify if we want a cache or no and we are in production
+    if (cache === true || (cache !== false && process.env.NODE_ENV === 'production')) {
+      res.setHeader('Cache-Control', 'public')
+    } else {
+      res.setHeader('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate')
     }
+
+    next()
   }
+}
 
-  // ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
 
-  module.exports = cacheMiddleware
-})()
+module.exports = cacheMiddleware