mirror of
https://github.com/dap-ps/discover.git
synced 2025-02-07 15:05:07 +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:
parent
19608fadc5
commit
856e95a021
@ -1,3 +1,4 @@
|
|||||||
|
const path = require('path')
|
||||||
const config = require('./config')
|
const config = require('./config')
|
||||||
|
|
||||||
function setupSystem() {
|
function setupSystem() {
|
||||||
@ -23,6 +24,12 @@ async function setupAPI() {
|
|||||||
setupPostRoutedAppMiddlewares(app);
|
setupPostRoutedAppMiddlewares(app);
|
||||||
|
|
||||||
app.use(express.static('frontend'));
|
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);
|
app.listen(config.PORT);
|
||||||
console.log(`Server started on port: ${config.PORT}`);
|
console.log(`Server started on port: ${config.PORT}`);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user