Tuesday, 4 April 2017

React Router intercepting API call to Express server

I'm using React Router with Passport.js to set up Facebook login. I've set up the express routes and passport config, but every time I hit the <a href="/api/auth/facebook"> link on my client side, it makes a request to RR because of my express app with this line:

app.get('/*', function(req, res) {
  res.sendFile(path.resolve(__dirname, '../client', 'build', 'index.html'))
});

As I am making a call to the server side route, it returns this error:

Warning: [react-router] Location "/api/auth/facebook" did not match any routes

How can I bypass React Router for this one particular route?



via Eric Vanular

No comments:

Post a Comment