aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/client.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/client.ts')
-rw-r--r--server/controllers/client.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/server/controllers/client.ts b/server/controllers/client.ts
index 352d45fbf..bbb518c1b 100644
--- a/server/controllers/client.ts
+++ b/server/controllers/client.ts
@@ -5,6 +5,7 @@ import { ACCEPT_HEADERS, STATIC_MAX_AGE } from '../initializers'
5import { asyncMiddleware } from '../middlewares' 5import { asyncMiddleware } from '../middlewares'
6import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '../../shared/models/i18n/i18n' 6import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '../../shared/models/i18n/i18n'
7import { ClientHtml } from '../lib/client-html' 7import { ClientHtml } from '../lib/client-html'
8import { logger } from '../helpers/logger'
8 9
9const clientsRouter = express.Router() 10const clientsRouter = express.Router()
10 11
@@ -66,9 +67,14 @@ clientsRouter.use('/client/*', (req: express.Request, res: express.Response, nex
66 67
67// Always serve index client page (the client is a single page application, let it handle routing) 68// Always serve index client page (the client is a single page application, let it handle routing)
68// Try to provide the right language index.html 69// Try to provide the right language index.html
69clientsRouter.use('/(:language)?', function (req, res) { 70clientsRouter.use('/(:language)?', async function (req, res) {
70 if (req.accepts(ACCEPT_HEADERS) === 'html') { 71 if (req.accepts(ACCEPT_HEADERS) === 'html') {
71 return generateHTMLPage(req, res, req.params.language) 72 try {
73 await generateHTMLPage(req, res, req.params.language)
74 return
75 } catch (err) {
76 logger.error('Cannot generate HTML page.', err)
77 }
72 } 78 }
73 79
74 return res.status(404).end() 80 return res.status(404).end()