updated run script for frontend

This commit is contained in:
Ulf Gebhardt 2022-01-05 19:58:34 +01:00
parent 71c3d3c37f
commit 2347deb317
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9

View File

@ -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)
})