How is routing handled in the mern stack?

I’m really confused, because there is routing in express and react. Should i do my routing in the client or backend?

If you’re writing a single-page app, you’d use both: react-router maps urls to components purely client-side, without involving the server. Meanwhile the app will make api requests to the backend, and those will be routed by express. Since you’re probably not starting with an SPA, you’ll most likely start off using only express’s server-side routing.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.