Skip to content

API communication

Creapermann edited this page Oct 30, 2022 · 3 revisions

This document describes how the Librum client application talks to the backend API.

What is Librum's backend API?

Librum itself is divided into client-side and server-side. The client-side application deals with the presentation of data to its users, whereas the server-side application manages the storage of data, which includes authentication, loading books, you get it...

How and where does API communication take place?

In Librum, all the API communication happens in the Infrastructure layer (Librum's layers). There is no other place where HTTP communication with any other service takes place.
Usually, API requests, such as creating a book, are initiated from the Application layer, which uses a Gateway (Adapters layer) to map the given data to the correct type. Librum's backend API mostly demands DTOs (Data transfer objects), which are simple C++ structs with no logic, which just hold data. The Gateway then passes this DTO to the corresponding function of an Infrastructure-layer class, which makes the actual call to the database.

The client-side and server-side application talk exclusively via JSON messages, which are then parsed and used correspondingly.

Clone this wiki locally