-
Controllers
The code of the routes/endpoints. This layer is dumb and should not have any logic. If needed could orchestrate multiple services.
knowledge of: payloads
-
Payloads
It has the structure of the json that we should return on our api calls.
knowledge of: payloads
-
Services
All the business logic belongs here
knowledge of: payloads, models
-
Models
This is the database layer. We should define here the schemas of our mongo documents
knowledge of: models
-
Repos
It has the code that is reponsible to communicate with the database
knowledge of: models
-
Mappers
knowledge of: payloads, models
Note: The "knowledge of:" is very important as it points out the knowledge of each layer. This gives us an advantage of having a clear separation of concerns (SoC) which makes the code easier to extend, maintain.
GET /bugs
Get a list of bugs sorted ASC by priority
GET /bugs/:id
Get a bug by id
POST /bugs
Create a bug
PUT /bugs/:id
Update a bug
DELETE /bugs/:id
Delete a bug