node.js – Use of routes in frontend or backend

Question:

Regarding routing, is it more suitable for routing to be in the front and the same make requests to the server through AJAX, or for routing to be in the back and the same render the views from the front ?

Answer:

False dichotomy, because routing in one or the other exists to route what is in that layer, the fact that it is used in one layer does not make it unnecessary to use it in another, of course, as long as you are using architectures that require routing. In other words, whether to use it or not has nothing to do with what the question is concerned with, but whether it makes sense in the architecture used in that layer.

You can use routing on one of them and not on another simply because the architecture of that layer was designed in a way that doesn't need routing.

Routing is generally necessary for complex architectures, and there was a time when people only adopted complex solutions to complex problems (some people still do, thankfully), but today it's common for people to adopt complex architectures because it's fashionable, the person he adopts without even understanding why he is doing what he is doing and what benefit he will have by adopting that.

I see people avoiding adopting routing with React in the frontend (or was it).

Scroll to Top