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
Using the react-starterkit setup and have added a new route /authenticate. When I post to the route, I get a response "Cannot POST /authenticate". However, it will happily route to it via a GET.
for example: on('/authenticate', async () => <div>hello</div>);
will error with a POST, but return the element with a GET. Does the router support POST operations or am I doing something very wrong?
The text was updated successfully, but these errors were encountered:
This router is only supposed to be used with GET HTTP requests for rendering React apps on the server and on the client. To add /authenticate endpoint on the server, you can use Express functionality, for example, in server.js:
app.post('/authenticate',(req,res)=>{// todo: validate user, issue an authentication token});
Using the react-starterkit setup and have added a new route /authenticate. When I post to the route, I get a response "Cannot POST /authenticate". However, it will happily route to it via a GET.
for example:
on('/authenticate', async () => <div>hello</div>);
will error with a POST, but return the element with a GET. Does the router support POST operations or am I doing something very wrong?
The text was updated successfully, but these errors were encountered: