Fix local path when serving files
This commit is contained in:
parent
14a3cf308b
commit
4991ab7b91
3
main.js
3
main.js
@ -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`);
|
||||
|
@ -53,6 +53,7 @@
|
||||
"electron-builder": "^22.9.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"connect-history-api-fallback": "^1.6.0",
|
||||
"express": "^4.17.1"
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user