Skip to content

Commit

Permalink
Updated main and backend READMEs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Owczarek committed Jan 8, 2020
1 parent ac41509 commit a7aeae3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/main/g8/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ can find another a README.md file describing its content.

Briefly:
* `shared` - contains a global model and a login of the application, it also keeps CSS styles definition and RPC interfaces;
* `backend` - holds the server-side logic, it uses [Spring](https://spring.io/) for DI and [Jetty](https://www.eclipse.org/jetty/) as the servlets container;
* `frontend` - keeps views and the client's application logic.
* `backend` - holds the server-side logic, it uses [Jetty](https://www.eclipse.org/jetty/) as the servlets container;
* `frontend` - keeps views and the client's application logic.

Each module contains tests based on [ScalaTest](http://www.scalatest.org/) and [ScalaMock](http://scalamock.org/).
The `frontend` and `shared` modules use [scalajs-env-selenium](https://github.com/scala-js/scala-js-env-selenium) in order
Expand Down
21 changes: 7 additions & 14 deletions src/main/g8/backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ You can find five main packages in the sources of this module:
* `$package$.backend.rpc` - an implementation of the server RPC interfaces.
* `$package$.backend.server` - the code setting up [Jetty](https://www.eclipse.org/jetty/) with required servlets.
* `$package$.backend.services` - services encapsulating the main business logic of the application.
* `$package$.backend.spring` - utilities handling [Spring](https://spring.io/) dependency injection.

## RPC and Services

The main responsibility of the server application is to handle RPC calls from client applications.
The implementation is separated into two layers:
* RPC endpoints - created separately for each client connection which are a direct implementation of the RPC interfaces;
* services - created once as beans in the [Spring](https://spring.io/) application context.
* services - created once in the `Launcher` object.

The endpoints are a good place to resolve `UserContext` or verify user's permissions. The services usually
contain business logic reusable between endpoints and other entry points of the app e.g. REST API.
Expand All @@ -24,21 +23,15 @@ Read more about the RPC interfaces in the [Udash Guide](http://guide.udash.io/#/

## Server and configuration

This application uses [Spring](https://spring.io/) for dependency injection with an extension from
[AVSystem Commons](https://github.com/AVSystem/scala-commons), which allows us to write configuration
using the [HOCON](https://github.com/lightbend/config/blob/master/HOCON.md) format. The configuration files are localized
in the resource bundles stored in `backend/src/main/resources`. This directory also contains translation bundles and basic
The configuration file (`application.conf`) contains application configuration variables e.g. the user list or the web
server port. It is stored in `backend/src/main/resources`. This directory also contains translation bundles and basic
[Logback](https://logback.qos.ch/) configuration.

The application configuration is separated into three files:
* `application.conf` - application configuration variables e.g. the user list or the web server port.
* `beans.conf` - the main configuration file which contains web server bean definition.
* `services.conf` - definition of services beans.

As you can see, the `Launcher` object loads configuration from `beans.conf` and starts `ApplicationServer`.
As you can see, the `Launcher` object loads configuration from `application.conf` using
[Typesafe Config](https://lightbend.github.io/config/), creates services and starts `ApplicationServer`.
The `ApplicationServer` class creates two servlets: the first serves static files like compiled JS or CSS sources,
the second is responsible for handling WebSocket connections from the client applications. The aforementioned
servlets are registered in the [Jetty](https://www.eclipse.org/jetty/) server.
the second is responsible for handling WebSocket connections from the client applications. The aforementioned servlets
are registered in the [Jetty](https://www.eclipse.org/jetty/) server.

Read more about bootstrapping the backend application in the [Udash Guide](http://guide.udash.io/#/bootstrapping/backend).

Expand Down

0 comments on commit a7aeae3

Please sign in to comment.