From 2347deb31757dec24de87818489040379ab2f8be Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 5 Jan 2022 19:58:34 +0100 Subject: [PATCH] updated run script for frontend --- frontend/run/server.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/frontend/run/server.js b/frontend/run/server.js index 8a3f54557..c935009d8 100644 --- a/frontend/run/server.js +++ b/frontend/run/server.js @@ -1,3 +1,4 @@ +/* // Imports const express = require('express') const serveStatic = require('serve-static') @@ -13,3 +14,22 @@ app.listen(port) // eslint-disable-next-line no-console console.log(`http://frontend:${port} server started.`) +*/ + +const express = require('express') +const path = require('path') + +const hostname = '127.0.0.1' +const port = process.env.PORT || 3000 + +const app = express() +app.use(express.static(path.join(__dirname, '../dist'))) + +app.get('*', (req, res) => { + res.sendFile(__dirname, '../dist/index.html') +}) + +app.listen(port, hostname, () => { + // eslint-disable-next-line no-console + console.log('Listening at http://%s:%s/', hostname, port) +})