mirror of
https://github.com/go-vikunja/vikunja.git
synced 2025-12-05 19:16:51 -06:00
fix(desktop): use app.use to serve frontend files
This fix avoids route patterns and instead uses a middleware to serve frontend files in express. The route pattern was causing errors in the path-to-regexp package used by express. Resolves https://github.com/go-vikunja/vikunja/issues/687 Resolves https://community.vikunja.io/t/the-state-of-the-windows-desktop-app/3618/4
This commit is contained in:
@@ -35,9 +35,9 @@ function createWindow() {
|
||||
|
||||
// Start a local express server to serve static files
|
||||
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`);
|
||||
// Handle urls set by the frontend - use app.use as catch-all instead of route pattern
|
||||
eApp.use((request, response) => {
|
||||
response.sendFile(path.join(__dirname, frontendPath, 'index.html'))
|
||||
})
|
||||
const server = eApp.listen(port, '127.0.0.1', () => {
|
||||
console.log(`Server started on port ${server.address().port}`)
|
||||
|
||||
Reference in New Issue
Block a user