Table of Contents

Reference notes

We are going to use release/release-1.0.0 as the branch for this Unit. See the link here.

POM Dependencies

Let’s explain the purpose of the following dependencies:

spring-boot-starter-web

This dependency will be used to manage HTTP requests. as it contains an embedded server, it will be easy to set the server up locally.

On the other hand, we will be able to use annotations like @RestController, @GetMapping, @PutMapping, @PostMapping, @DeleteMapping, @RequestParam, and @RequestBody.

Controller

For being able to manage HTTP requests, we will need to implement a Controller, this file will be responsible for defining the Data Transfer Objects that will be received and returned on each endpoint.

(link to the controller class on release branch)

We are going to need to inject the service interface through dependency injection using @Autowired annotation.

Service

This layer is where all business logic stays, it is responsible for managing the data input that comes from the Controller layer and returning it to it again later. If we need to call another API, make some queries to DB, or get data from elsewhere, all business logic will happen on this layer.

Repository

Where all the requests to a DB, API services, and so on happens. In our example we are going to implement MongoRepository class.

We are going to define