How many routers are we able to have?
That will depend on how we are handling data and how many different routes we have. There is no real cap on the number of routers to set, for example if we were to make a banking app, then our app’s front-end requests to our servers will probably have to…
/logoutthis could be set as one router to
/session/logout(POST on session), and
/usergo through a
/transactionswhich from each we can get a single account and transaction, and at least
Don some actions.
we can also have a
/servicesroute that can handle bank related requests like opening a new account or contacting customer service.
As we can see, there we have the possibility to divide our routes into at least 3 routers(
/services), but for
/user we might also want to nest three routers, one for the user’s information, a second one to handle
/accounts requests, and a third for
We can have as many routers as we need in an app, it will always be related to how our server will receive requests, what kind of data will be in our responses, and from where is that data coming from (database, other API, etc.).