- Martin Kuzdowicz
- Java 8
- Scala 2.12.4
- sbt 1.0.4
sbt test
sbt assembly
sbt "runMain com.kuzdowiczm.web.rest.upservice.Application"
App can be deployed as a docker container for example on AWS ECS
In this example the server is embeded in the service as a Akka-HTTP application
-
to run example GET after Application started request you will need initial user id
-
to create a new user with associated organisation you will need id of created organisation as we do not have yet endpoint to create organisations
For convenience after the application is started from the command line, it will create some initial data
And initial fake resources ID's will be logged
creating initial data ...
initial organisation id => f18952e1-e26b-4d0a-a1b2-e365762a4cd4
initial user id => bb3888d1-f7f7-47e8-ac71-c47fcb3d2f72
(Server.scala:33) - user-profiles-service running on /127.0.0.1:8080
With that initial data you can execute example requests in the browser or with Postman
-
example GET request with initial data:
endpoint:
http://localhost:8080/user-profile-service/users/bb3888d1-f7f7-47e8-ac71-c47fcb3d2f72
-
example POST request with created organisation:
endpoint:
http://localhost:8080/user-profile-service/users
body:
{ "firstname": "name", "lastname": "lname", "email": "[email protected]", "salutation": "Mr", "telephone": "+44 123 123 0000", "type": "barrister", "orgId": "f18952e1-e26b-4d0a-a1b2-e365762a4cd4", "address": { "postcode": "EC2 99Y"} }
-
example PUT request with created organisation:
endpoint:
http://localhost:8080/user-profile-service/users
body:
{ "id": "bb3888d1-f7f7-47e8-ac71-c47fcb3d2f72", "firstname": "new-name", "lastname": "new-lname", "email": "[email protected]", "salutation": "Mr", "telephone": "+44 123 123 0000", "type": "barrister", "orgId": "f18952e1-e26b-4d0a-a1b2-e365762a4cd4", "address": { "postcode": "EC2 99Y"} }
-
example DELETE request with initial data:
endpoint:
http://localhost:8080/user-profile-service/users/bb3888d1-f7f7-47e8-ac71-c47fcb3d2f72
- endpoints and functions for handling organisations
- endpoint for all users with pagination
- implementation with a real database not only an in memory solution