aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/client.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-11-25 12:32:21 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-11-25 14:21:41 +0100
commit79530164b6c8f96a6ccf6d33b591d565f1575e67 (patch)
treef610a32ad5cb7151247af12dcc1534d4adb7de37 /server/controllers/client.js
parent8e124f999b8cf7d461ef7a923711d18edc69d84c (diff)
downloadPeerTube-79530164b6c8f96a6ccf6d33b591d565f1575e67.tar.gz
PeerTube-79530164b6c8f96a6ccf6d33b591d565f1575e67.tar.zst
PeerTube-79530164b6c8f96a6ccf6d33b591d565f1575e67.zip
Server: move static/client routes in controllers/
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