Fix local path when serving files
continuous-integration/drone/push Build was killed Details

This commit is contained in:
kolaente 2020-10-17 19:54:02 +02:00
parent 14a3cf308b
commit 4991ab7b91
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 8 additions and 1 deletions

View File

@ -1,4 +1,5 @@
const {app, BrowserWindow, shell} = require('electron')
const path = require('path')
const express = require('express')
const eApp = express()
@ -24,7 +25,7 @@ function createWindow() {
mainWindow.setMenuBarVisibility(false)
// Start a local express server to serve static files
eApp.use(express.static(frontendPath))
eApp.use(express.static(path.join(__dirname, frontendPath)))
// Handle urls set by the frontend
eApp.get('*', (request, response, next) => {
response.sendFile(`${__dirname}/${frontendPath}index.html`);

View File

@ -53,6 +53,7 @@
"electron-builder": "^22.9.1"
},
"dependencies": {
"connect-history-api-fallback": "^1.6.0",
"express": "^4.17.1"
}
}

View File

@ -433,6 +433,11 @@ configstore@^5.0.1:
write-file-atomic "^3.0.0"
xdg-basedir "^4.0.0"
connect-history-api-fallback@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc"
integrity sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==
content-disposition@0.5.3:
version "0.5.3"
resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd"