Contains the CRUD JPA microservice which operates review. User can POST 1 to 5 scope for the product. Service im 8000 plemented in Kotlin which I'm have no experience with. Just as demonstraction that I can dive in quickly into new JVM language.
$ ./gradlew :review-service:bootJar
$ java -jar review-service/build/libs/review-service.jar
Writing end-points requires basic authentication.
Authorized request:
$ curl -X POST -v -u user:password localhost:8081/rating/1/5
201 Created status responded
$ curl -X POST -v localhost:8081/rating/1/5
401 Unauthorized status responded
Request:
$ curl localhost:8081/rating/1
Response:
{
"productId": 1,
"rating": 3.6666667,
"total": 3
}
Contains the shared (by review-client and review-service) model classes.
Contains the reactive client to call review-service
Contains microservice aggregating results from external API and review-service. As an external API I used Dummy Rest API instead of Adidas, because Adidas introduced some kind of WAF which is blocking some of the requests. So I decided that bypassing the WAS is out of the scope of this task.
$ ./gradlew :aggregate-service:bootJar
$ java -jar aggregate-service/build/libs/aggregate-service.jar --review.host=localhost
Request
$ curl localhost:8080/aggregate/2
Response:
{
"product": {
"id": 2,
"title": "iPhone X",
"description": "SIM-Free, Model A19211 6.5-inch Super Retina HD display with OLED technology A12 Bionic chip with ..."
},
"rating": {
"productId": 2,
"rating": 5,
"total": 1
}
}
Request:
$ curl -s localhost:8080/aggregate/3
Response has no rating, 404 error handled correctly:
{
"product": {
"id": 3,
"title": "Samsung Universe 9",
"description": "Samsung's new variant which goes beyond Galaxy to the Universe"
},
"rating": null
}
200 OK status returned
Request:
$ curl -s -v localhost:8080/aggregate/1000
Response:
$ curl -s localhost:8080/aggregate/1000 | jq .
{
"timestamp": "2023-05-10T09:45:19.477+00:00",
"status": 404,
"error": "Not Found",
"message": "No such product with given ID: 1000",
"path": "/aggregate/1000
404 status returned.
$ ./gradlew :review-service:bootRun
$ docker build -t aggragate-challenge/review-service review-service/
$ ./gradlew :aggregate-service:bootJar
$ docker build -t aggragate-challenge/aggregate-service aggregate-service/
$ docker-compose up