aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/client.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/client.js')
-rw-r--r--server/controllers/client.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/server/controllers/client.js b/server/controllers/client.js
index 61e094980..572db6133 100644
--- a/server/controllers/client.js
+++ b/server/controllers/client.js
@@ -13,8 +13,9 @@ const Video = mongoose.model('Video')
13const router = express.Router() 13const router = express.Router()
14 14
15const opengraphComment = '<!-- opengraph tags -->' 15const opengraphComment = '<!-- opengraph tags -->'
16const embedPath = path.join(__dirname, '../../client/dist/standalone/videos/embed.html') 16const distPath = path.join(__dirname, '../../client/dist')
17const indexPath = path.join(__dirname, '../../client/dist/index.html') 17const embedPath = path.join(distPath, 'standalone/videos/embed.html')
18const indexPath = path.join(distPath, 'index.html')
18 19
19// Special route that add OpenGraph tags 20// Special route that add OpenGraph tags
20// Do not use a template engine for a so little thing 21// Do not use a template engine for a so little thing
@@ -24,6 +25,14 @@ router.use('/videos/embed', function (req, res, next) {
24 res.sendFile(embedPath) 25 res.sendFile(embedPath)
25}) 26})
26 27
28// Static HTML/CSS/JS client files
29router.use('/client', express.static(distPath, { maxAge: constants.STATIC_MAX_AGE }))
30
31// 404 for static files not found
32router.use('/client/*', function (req, res, next) {
33 res.sendStatus(404)
34})
35
27// --------------------------------------------------------------------------- 36// ---------------------------------------------------------------------------
28 37
29module.exports = router 38module.exports = router