diff options
Diffstat (limited to 'vnext/server/middleware/renderer.js')
-rw-r--r-- | vnext/server/middleware/renderer.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/vnext/server/middleware/renderer.js b/vnext/server/middleware/renderer.js index 4223d7f2..a4b745f8 100644 --- a/vnext/server/middleware/renderer.js +++ b/vnext/server/middleware/renderer.js @@ -1,5 +1,6 @@ import * as ReactDOMServer from 'react-dom/server'; import cookie from 'cookie'; +import config from 'config'; // import our main App component import App from '../../src/App'; @@ -20,10 +21,12 @@ function toBinary(string) { return Buffer.from(String.fromCharCode(...new Uint8Array(codeUnits.buffer))).toString('base64'); } +const STATIC_ROOT = config.get('service.static_root') || path.resolve(__dirname, 'dist'); + const serverRenderer = async (req, res) => { // point to the html file created by CRA's build tool - const filePath = path.resolve('index.html'); + const filePath = path.resolve(STATIC_ROOT, 'index.html'); // links const cookies = cookie.parse(req.headers.cookie || ''); |