I'm facing a scenario that goes like this:
Endpoint 1: Retrieve all books in the United States owned by John with a GET Request
to /country/us/person/john/books
Endpoint 2: Get all books owned by John in every country with a GET Request
to /person/john/books
Endpoint 3: Fetch all books across all countries using a GET Request
to /country/books
I am planning on creating a rest server using NestJS
(although not directly related to this question) which leverages the concept of modules
for organizing controllers
.
In this context, should I create:
- A single
module
namedbooks
containing onecontroller
managing three routes. Or, - Split it into two
modules
, namelybooksByCountry
andbooksByPerson
Is there a best practice or recommendation when approaching this situation?