From 657af5906ed50acc9bacea487ac22b6c9c961571 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 30 Oct 2022 01:51:42 +0300 Subject: Read static root from the config --- vnext/server/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'vnext/server/index.js') diff --git a/vnext/server/index.js b/vnext/server/index.js index f9a432b9..729f05d6 100644 --- a/vnext/server/index.js +++ b/vnext/server/index.js @@ -1,4 +1,5 @@ import express from 'express'; +import config from 'config'; // we'll talk about this in a minute: import serverRenderer from './middleware/renderer'; @@ -18,9 +19,11 @@ router.get('/api/oembed', oembed); router.get('/api/urlexpand', urlExpand); router.use('^/$', serverRenderer); +const STATIC_ROOT = config.get('service.static_root') || path.resolve(__dirname, 'dist'); + // other static resources should just be served as they are router.use(express.static( - path.resolve(__dirname), + STATIC_ROOT, { maxAge: '30d' }, )); -- cgit v1.2.3