1
0
mirror of https://github.com/dap-ps/discover.git synced 2025-01-31 11:35:18 +00:00

add a catch-all to express for paths not matching specific files

For more details see this issue:
https://stackoverflow.com/questions/27928372/react-router-urls-dont-work-when-refreshing-or-writing-manually

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-08-08 12:37:51 -04:00 committed by Andy Tudhope
parent 19608fadc5
commit 856e95a021

View File

@ -1,3 +1,4 @@
const path = require('path')
const config = require('./config')
function setupSystem() {
@ -23,6 +24,12 @@ async function setupAPI() {
setupPostRoutedAppMiddlewares(app);
app.use(express.static('frontend'));
/* Handles any requests that don't match the ones above */
app.get('*', (req,res) =>{
res.sendFile(path.join(__dirname, 'frontend/index.html'));
});
app.listen(config.PORT);
console.log(`Server started on port: ${config.PORT}`);