From af5049c98e3a546c042bf127df23c466907c6cf1 Mon Sep 17 00:00:00 2001 From: Kevin Thomas Date: Thu, 11 Nov 2021 00:22:41 -0800 Subject: [PATCH] Fix serving static files with connect-history-api-fallback --- server/app.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/app.js b/server/app.js index c5bbaab..24e2751 100644 --- a/server/app.js +++ b/server/app.js @@ -18,14 +18,18 @@ const fileStoreOptions = { require('./boot/db')() require('./boot/auth')() -app.use(history()) app.use(express.json()) app.use(express.urlencoded({ extended: false })) app.use(cookieParser()) if (process.env.NODE_ENV === 'production') { app.use(express.static(path.join(__dirname, '../dist'))) } + +// Workaround for allowing static files to be served while using connect-history-api-fallback app.use('/samples', express.static(path.join(__dirname, '../', config.get('Server.sampleUploadPath')))) +app.use(history()) +app.use('/samples', express.static(path.join(__dirname, '../', config.get('Server.sampleUploadPath')))) + app.use(session({ store: new FileStore(fileStoreOptions), secret: config.get('Server.sessionSecret'),