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
So I'm setting up an express server for custom routing.
Suppose I have a route like this /u/:username . After parsing the query param, I need to hit the database, find that username and decide whether I should render a profile page or an 404 page.
I have 2 places to do the validating in mind:
At express server
Pros: Sending correct HTTP_STATUS code because I can't find a way to send 404 status within the React app
Cons: Hit the database server twice because in the client side, I need extra information rather than just a validated username to render the page. Query all of the data in the express server and sending it via ctx would be super complicated. For clarification, I'm using Apollo Client for managing the data.
@nkzawa oh nice. Thank you. I was worry for a while before posting the above post. Putting the logic in express mean I have to keep the code in sync manually.
So I'm setting up an express server for custom routing.
Suppose I have a route like this
/u/:username
. After parsing the query param, I need to hit the database, find that username and decide whether I should render a profile page or an 404 page.I have 2 places to do the validating in mind:
At express server
ctx
would be super complicated. For clarification, I'm using Apollo Client for managing the data.At React app
The text was updated successfully, but these errors were encountered: