ScalaConsultants / rapid-development

0 stars 1 forks source link

Play App for rapid development

Raw facts

Goals

Database for local development

Setting up

Project uses PostgreSQL 9.6. In the project's root directory run

docker-compose up -d

To access instance running in the docker:

docker exec -it postgres-rapid-development psql -U postgres-dev -d rapid-development -W
Migration using Flyway
sbt -Dflyway.url="jdbc:postgresql://127.0.0.1:5432/rapid-development" -Dflyway.user=postgres-dev -Dflyway.password=secretpass core/flywayMigrate

Available endpoints

/healthcheck

Status of the application itself, additionally shows build data.

Example API: manipulating notes

Modularization of rapid-development app

As rapid-development has been designed as a template for creating applications we divided it into submodules to help to separate concerns. As for now there are 2 submodules defined under /modules path:

core contains of two main packages: io.scalac.common and io.scalac.domain. The first one is responsible for handling cross-cutting concerns as e.g. logging while the second one is responsible for pure business logic. In future core may be split into two modules.

Authorization

Authentication and authorization is build using Sillouette. There is support for sign up, sign in and log out using Bearer Tokens.

curl -X "POST" "http://localhost:9000/auth/signup" \
     -H "X-Correlation-Id: fe0c44e9-8d08-4000-84b2-57ac8415c370" \
     -H "Content-Type: application/json" \
     -d $'{
  "firstName": "Franek",
  "lastName": "Dolas",
  "email": "franek@dolas.pl",
  "password": "secret"
}'
curl -X "POST" "http://localhost:9000/auth/signin" \
     -H "X-Correlation-Id: 657eb889-d393-4be7-8993-74d2fb21c7dc" \
     -H "Content-Type: application/json" \
     -d $'{
  "email": "franek@dolas.pl",
  "rememberMe": true,
  "password": "secret"
}'
curl -X "POST" "http://localhost:9000/auth/signout" \
     -H "X-Correlation-Id: 0bac9444-fb58-4d87-be1a-3b7e409d9fca" \
     -H "X-Auth-Token: 0d6802de92554c0877353e2ba43cafa954bebe4cb129e007396b20d191aea4b79acb70a5173387589374bec0c5021901de98446b2d204b5b825a9b7300e46ac6515d6f2fae6522a71c43a561c75b5652bf710294f1d9a7f37df1304a6f89ce00097c964faef12bb93115158c80388eba92e0d50f0a42af2d5709e0c272e0023f"

Missing parts

Look for TODOs in code.

Most of the code is based on sample projects which uses cookies and another one which uses Bearer Token.

Developed by Scalac