]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server.js
Server: Remove unused console log
[github/Chocobozzz/PeerTube.git] / server.js
index a7d7e781cf311709e702d22464066b8f4c29c06b..16e27e852cba100efa20ee9614f82a53599a100a 100644 (file)
--- a/server.js
+++ b/server.js
@@ -69,8 +69,10 @@ app.use(expressValidator({
 // API routes
 const apiRoute = '/api/' + constants.API_VERSION
 app.use(apiRoute, routes.api)
+app.use('/', routes.client)
 
-// Static files
+// Static client files
+// TODO: move in client
 app.use('/client', express.static(path.join(__dirname, '/client/dist'), { maxAge: constants.STATIC_MAX_AGE }))
 // 404 for static files not found
 app.use('/client/*', function (req, res, next) {
@@ -88,9 +90,13 @@ app.use(constants.STATIC_PATHS.WEBSEED, cors(), express.static(videosPhysicalPat
 const thumbnailsPhysicalPath = constants.CONFIG.STORAGE.THUMBNAILS_DIR
 app.use(constants.STATIC_PATHS.THUMBNAILS, express.static(thumbnailsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE }))
 
-// Client application
+// Video previews path for express
+const previewsPhysicalPath = constants.CONFIG.STORAGE.PREVIEWS_DIR
+app.use(constants.STATIC_PATHS.PREVIEWS, express.static(previewsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE }))
+
+// Always serve index client page
 app.use('/*', function (req, res, next) {
-  res.sendFile(path.join(__dirname, 'client/dist/index.html'))
+  res.sendFile(path.join(__dirname, './client/dist/index.html'))
 })
 
 // ----------- Tracker -----------