cleanup run script (frontend)

include new run script(admin)
This commit is contained in:
Ulf Gebhardt 2022-01-05 20:20:49 +01:00
parent c0d5fea248
commit 00ecc2b999
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
2 changed files with 19 additions and 29 deletions

View File

@ -1,15 +1,21 @@
// Imports
const express = require('express')
const serveStatic = require('serve-static')
const path = require('path')
// Port
const port = process.env.PORT || 8080
// Host & Port
const hostname = '127.0.0.1'
const port = process.env.PORT || 3000
// Express Server
const app = express()
// eslint-disable-next-line node/no-path-concat
app.use(serveStatic(__dirname + '/../dist'))
app.listen(port)
// Serve files
app.use(express.static(path.join(__dirname, '../dist')))
// Default to index.html
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, '../dist/index.html'))
})
// eslint-disable-next-line no-console
console.log(`http://admin:${port} server started.`)
app.listen(port, hostname, () => {
// eslint-disable-next-line no-console
console.log('Listening at http://%s:%s/', hostname, port)
})

View File

@ -1,33 +1,17 @@
/*
// Imports
const express = require('express')
const serveStatic = require('serve-static')
const path = require('path')
// Port
// Host & Port
const hostname = '127.0.0.1'
const port = process.env.PORT || 3000
// Express Server
const app = express()
// eslint-disable-next-line node/no-path-concat
app.use(serveStatic(__dirname + '/../dist'))
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()
// Serve files
app.use(express.static(path.join(__dirname, '../dist')))
// Default to index.html
app.get('*', (req, res) => {
// eslint-disable-next-line no-console
console.log('Request', req)
res.sendFile(path.join(__dirname, '../dist/index.html'))
})