You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have deploy both https://github.com/cheatcode/nodejs-server-boilerplate and https://github.com/cheatcode/nextjs-boilerplate on different servers but I am having problems with the authentication flow. The login method requires setting a cookie for authentication token but when server and client on cross domain, it is not able to set the cookie. Therefore I have put the client files under backend/client and redirected all traffic except api/graphql to client/build/index.html with the following code.
app.use(express.static('client/build'));
app.get('/api/graphql', (req, res) => {
//What to do here to direct traffic to graphql server
});
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname + 'client/build/index.html'));
});
But I couldn't find a way to direct api/graphql to the graphql server.
is there a better approach?
The text was updated successfully, but these errors were encountered:
I have deploy both https://github.com/cheatcode/nodejs-server-boilerplate and https://github.com/cheatcode/nextjs-boilerplate on different servers but I am having problems with the authentication flow. The login method requires setting a cookie for authentication token but when server and client on cross domain, it is not able to set the cookie. Therefore I have put the client files under
backend/client
and redirected all traffic exceptapi/graphql
toclient/build/index.html
with the following code.But I couldn't find a way to direct
api/graphql
to the graphql server.is there a better approach?
The text was updated successfully, but these errors were encountered: