mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
Prepare folders structure for angular app
This commit is contained in:
parent
b2ff5e3e68
commit
b9a3e09ad5
60 changed files with 13 additions and 86 deletions
23
server/middlewares/cache.js
Normal file
23
server/middlewares/cache.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
'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')
|
||||
}
|
||||
|
||||
next()
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
module.exports = cacheMiddleware
|
Loading…
Add table
Add a link
Reference in a new issue