diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/client.ts | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/server/controllers/client.ts b/server/controllers/client.ts index f5124c55b..2fcca6f76 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts | |||
@@ -11,8 +11,6 @@ const clientsRouter = express.Router() | |||
11 | 11 | ||
12 | const distPath = join(root(), 'client', 'dist') | 12 | const distPath = join(root(), 'client', 'dist') |
13 | const assetsImagesPath = join(root(), 'client', 'dist', 'client', 'assets', 'images') | 13 | const assetsImagesPath = join(root(), 'client', 'dist', 'client', 'assets', 'images') |
14 | const manifestPath = join(root(), 'client', 'dist', 'manifest.json') | ||
15 | const serviceWorkerPath = join(root(), 'client', 'dist', 'ngsw-worker.js') | ||
16 | const embedPath = join(distPath, 'standalone', 'videos', 'embed.html') | 14 | const embedPath = join(distPath, 'standalone', 'videos', 'embed.html') |
17 | const indexPath = join(distPath, 'index.html') | 15 | const indexPath = join(distPath, 'index.html') |
18 | 16 | ||
@@ -27,8 +25,17 @@ clientsRouter.use('/videos/embed', (req: express.Request, res: express.Response, | |||
27 | }) | 25 | }) |
28 | 26 | ||
29 | // Static HTML/CSS/JS client files | 27 | // Static HTML/CSS/JS client files |
30 | clientsRouter.use('/manifest.json', express.static(manifestPath, { maxAge: STATIC_MAX_AGE })) | 28 | |
31 | clientsRouter.use('/ngsw-worker.js', express.static(serviceWorkerPath, { maxAge: STATIC_MAX_AGE })) | 29 | const staticClientFiles = [ |
30 | 'manifest.json', | ||
31 | 'ngsw-worker.js', | ||
32 | 'ngsw.json' | ||
33 | ] | ||
34 | for (const staticClientFile of staticClientFiles) { | ||
35 | const path = join(root(), 'client', 'dist', staticClientFile) | ||
36 | clientsRouter.use('/' + staticClientFile, express.static(path, { maxAge: STATIC_MAX_AGE })) | ||
37 | } | ||
38 | |||
32 | clientsRouter.use('/client', express.static(distPath, { maxAge: STATIC_MAX_AGE })) | 39 | clientsRouter.use('/client', express.static(distPath, { maxAge: STATIC_MAX_AGE })) |
33 | clientsRouter.use('/client/assets/images', express.static(assetsImagesPath, { maxAge: STATIC_MAX_AGE })) | 40 | clientsRouter.use('/client/assets/images', express.static(assetsImagesPath, { maxAge: STATIC_MAX_AGE })) |
34 | 41 | ||