diff options
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -71,7 +71,8 @@ const apiRoute = '/api/' + constants.API_VERSION | |||
71 | app.use(apiRoute, routes.api) | 71 | app.use(apiRoute, routes.api) |
72 | app.use('/', routes.client) | 72 | app.use('/', routes.client) |
73 | 73 | ||
74 | // Static files | 74 | // Static client files |
75 | // TODO: move in client | ||
75 | app.use('/client', express.static(path.join(__dirname, '/client/dist'), { maxAge: constants.STATIC_MAX_AGE })) | 76 | app.use('/client', express.static(path.join(__dirname, '/client/dist'), { maxAge: constants.STATIC_MAX_AGE })) |
76 | // 404 for static files not found | 77 | // 404 for static files not found |
77 | app.use('/client/*', function (req, res, next) { | 78 | app.use('/client/*', function (req, res, next) { |
@@ -89,6 +90,10 @@ app.use(constants.STATIC_PATHS.WEBSEED, cors(), express.static(videosPhysicalPat | |||
89 | const thumbnailsPhysicalPath = constants.CONFIG.STORAGE.THUMBNAILS_DIR | 90 | const thumbnailsPhysicalPath = constants.CONFIG.STORAGE.THUMBNAILS_DIR |
90 | app.use(constants.STATIC_PATHS.THUMBNAILS, express.static(thumbnailsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE })) | 91 | app.use(constants.STATIC_PATHS.THUMBNAILS, express.static(thumbnailsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE })) |
91 | 92 | ||
93 | // Video previews path for express | ||
94 | const previewsPhysicalPath = constants.CONFIG.STORAGE.PREVIEWS_DIR | ||
95 | app.use(constants.STATIC_PATHS.PREVIEWS, express.static(previewsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE })) | ||
96 | |||
92 | // Always serve index client page | 97 | // Always serve index client page |
93 | app.use('/*', function (req, res, next) { | 98 | app.use('/*', function (req, res, next) { |
94 | res.sendFile(path.join(__dirname, './client/dist/index.html')) | 99 | res.sendFile(path.join(__dirname, './client/dist/index.html')) |