Project structure:
<root>/conf/application.conf
- configuration file;<root>/conf/logback.xml
- logback configuration;<root>/app/controllers
- entity-specific controllers;<root>/app/persistence/dao
- entity-specific dao;<root>/app/persistence/mapping
- database mappings and query projections;<root>/play-rest-api-client/src/app
- Angular 4 client;<root>/docker
- docker configuration.
- Scala 2.12.4;
- SBT 0.13.16;
First of all, install NPM. Then install Angular 4 CLI.
Don't forget to configure a database in the application.conf
file.
In a <root>
folder:
sbt run
In a <root>/play-rest-api-client
folder:
ng serve --open
You application will be available at http://localhost:4200/
.
All settings are stored in the application.conf
.
application.rest.max-query-limit
- max value for the 'limit' parameter for 'list' requests;application.rest.auth.username
- basic auth login;application.rest.auth.password
- basic auth password;slick.dbs.default.db.url
- database connection url;slick.dbs.default.db.user
- database user;slick.dbs.default.db.password
- database password;
By default, application is listening on port 9000.
In a <root>
project folder write in a console
sbt gen-tables
Check database configuration in the application.conf
file before.
In a <root>
project folder execute
sbt universal:packageBin
The output file will be located at this place:
<root>/target/universal/play_rest_api.zip
Unzip an play_rest_api.zip
archive in any directory (<root>/dist
, for example).
Execute in a <root>/dist/play_rest_api
folder:
sh bin/play_rest_api
SBT will publish an image locally using a name based on a git hash.
Execute in a <root>
project folder:
sbt dev:docker
Check configuration properties in the docker-compose.yml
file.
Execute in a <root>/docker
project folder:
docker-compose up
Don't forget to create a database and tables.
Execute in a <root>
project folder:
sbt "release with-defaults"