This project has 2 services:
auth-api(port8080): register/login + protected/api/processdata-api(port8081): internal transform endpoint/api/transform
auth-api stores users and processing logs in Postgres.
auth-api/data-api/docker-compose.yml
From project root:
docker compose up -d --build
docker compose psOptional logs:
docker compose logs -f auth-api
docker compose logs -f data-apiIf you want to build without Docker first:
./auth-api/mvnw -f auth-api/pom.xml clean package -DskipTests
./data-api/mvnw -f data-api/pom.xml clean package -DskipTestsOn Windows PowerShell:
.\auth-api\mvnw.cmd -f auth-api\pom.xml clean package -DskipTests
.\data-api\mvnw.cmd -f data-api\pom.xml clean package -DskipTestscurl -X POST http://localhost:8080/api/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"a@a.com","password":"pass1234"}'Expected: HTTP 201.
curl -X POST http://localhost:8080/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"a@a.com","password":"pass1234"}'Expected response:
{"token":"<jwt>"}curl -X POST http://localhost:8080/api/process \
-H "Authorization: Bearer <jwt>" \
-H "Content-Type: application/json" \
-d '{"text":"hello"}'Expected:
{"result":"OLLEH"}And new row in processing_log.
Without X-Internal-Token (or wrong token), this should return 403:
curl -X POST http://localhost:8081/api/transform \
-H "Content-Type: application/json" \
-d '{"text":"hello"}'auth-api uses:
POSTGRES_URLPOSTGRES_USERPOSTGRES_PASSWORDJWT_SECRETINTERNAL_TOKENDATA_API_BASE_URL
data-api uses:
INTERNAL_TOKEN
Default values are also present in service application.properties for local runs.