fix(server): remote hotfix: correctly serving frontend in production from server

This commit is contained in:
Dimitrie Stefanescu
2021-01-04 14:00:23 +02:00
parent 8124f5285a
commit 4f0ab3e41d
+3 -2
View File
@@ -9,6 +9,7 @@ const compression = require( 'compression' )
const appRoot = require( 'app-root-path' )
const logger = require( 'morgan-debug' )
const bodyParser = require( 'body-parser' )
const path = require( 'path' )
const debug = require( 'debug' )
const Sentry = require( '@sentry/node' )
@@ -112,10 +113,10 @@ exports.startHttp = async ( app ) => {
// Production mode -> serve things statically.
else {
app.use( '/', express.static( `${appRoot}/../packages/frontend/dist` ) )
app.use( '/', express.static( path.resolve( `${appRoot}/../packages/frontend/dist` ) ) )
app.all( '*', async ( req, res ) => {
res.sendFile( `${appRoot}/../packages/frontend/dist/app.html` )
res.sendFile( path.resolve( `${appRoot}/../packages/frontend/dist/app.html` ) )
} )
}