Because I am using react router I cannot make specific file path references to every single route with react in Node. In order for their not to be a crash while getting a specific file path, I have to put this code in node.
app.use(express.static(path.join(__dirname, '/frontend-two')));
app.get('*', function(req,res) {
res.sendFile(path.join(__dirname, './frontend-two/index.html'));
});
I do, however, want to place a specific file path in order to send json data back to the client. It would interfere with the app.get('*') unless I can figure out a regex for specifically '/users' to be excluded.
Is there anyone who may know a possible regular expression to accomplish this? I have tried ideas through other questions but was unable to figure it out.
via Reagan Cuthbertson
No comments:
Post a Comment