Creating an application using the layered architecture
In the previous section, we saw how a backend application based on layered architecture can be structured. Our example has three layers: API, service, and data. Following this structure, we will develop a simple user application that allows user registration and login. We will implement the data layer, then proceed to the service layer, and then the API layer. The application will be based on Quarkus, so we can rely on the framework to provide REST endpoints and connect to a database.
Implementing the data layer
The data layer is responsible for allowing getting, persisting, and mapping external data. We rely on a database for the user application to store user information:
- So, let’s start by preparing Quarkus to enable us to use an H2 in-memory database:
quarkus.datasource.db-kind=h2 quarkus.datasource.jdbc.url=jdbc:h2:mem:default;DB_CLO SE_DELAY=-1.;NON_KEYWORDS=user quarkus.hibernate-orm.database...