-
Notifications
You must be signed in to change notification settings - Fork 1
Server Architecture
Server part is built using Java Spring WebFlux and Maven. Maven is a project management tool which encompasses a project object model, a set of standards, a project life cycle, a dependency management system, and logic for executing plugin goals at defined phases in a life cycle. Instead of downloading and placing the jars manually in the project, we use Maven to automate the process. Maven defines the dependencies in the pom.xml (Project object model) , which is located at the root application level:
Other than dependency management, Maven helps in cleaning and building the project. It is incorporated in Eclipse and can be used as well via command prompt.
To obtain a non-blocking web stack to handle concurrency with a small number of threads and scale with fewer hardware resources, we used Java Spring WebFlux, in particular we used a Functional Endpoints programming model: Lambda-based and functional programming model, with set of utilities that the application can use to route and handle requests.
Meaning of the main folders:
- spm.api: contains the main file for running the server.
- spm.api.config: contains server configuration files like cors, email and security configurations.
- spm.api.entity: contains simple Java classes representing the abstraction of each entity of MongoDb database that we used.
- spm.api.routes: contains the files that specify router functions used to route the requests to the corresponding handler function.
- spm.api.handlers: an handler is a function that accesses the HTTP method, URI, headers, query parameters or body of a single request. Then it uses a declarative composition of asynchronous logic to compose server response. In this asynchronous logic, a handler could use an abstraction level called service, to make database-side calls and perform business logic with retrieved data.
- spm.api.services: services are functions that use methods for database calls and perform business logic.
- spm.api.repository: a repository is an interface for principal database calls methods.