- Java 11
- Gradle
- Springboot
- Mongo DB
- Docker compose
- Makefile (optional)
- Using makefile, run
$ make start
This will build the dependencies (mongodb), build the app and run the containers all in one process.
- Seed the application's database
$ make seed-database
- See all trails:
GET /trails
- Find specific trail
GET /trails/trailName
- Book a trail
POST /booking
requestBody:
{
"trailName": "Shire",
"bookingDetails": {
"hikers": [
{
"name": "Christine",
"age": 31
},
{
"name": "Raul",
"age": 27
}
]
}
}
You will get a bookingId in the response. Save this for the next request.
- Find specific booking
GET /booking/bookingId
- Cancel a booking
DELETE /booking/bookingId
There is also a postman collection in the root folder with all of these requests.
This service was built using the hexagonal architecture design pattern. You can see a diagram representing the application below:
The idea here is that we are decoupling the domain and use cases (services) of the application from the external world (infastructure inputs and outputs) by reversing the dependency order. The domain should not know anything about the external world. The dependency should go from: external -> application -> domain, this way we can keep it pure and be ready for changes.
The application has around 30 tests, everything is covered. Two types of tests were made: unit and integration.