API for managing places (CRUD) that is part of this challenge for backend developers applying to ClickBus.
- SOLID
- Automated tests
- Dynamic filter queries using Query By Example
- Reactive API on the web and database layers
- Use of DTOs for the API
- Dependency Injection
- Automatic generation of Swagger with OpenAPI 3
- Automatic slug generation with Slugify
- Auditing for entity creation and updates
- Clone the git repository
- Build the project:
./mvnw clean package
- Execute:
java -jar reactive-location-api/target/reactive-location-api-0.0.1-SNAPSHOT.jar
The API can be accessed at localhost:8080. Swagger can be viewed at localhost:8080/swagger-ui.html
To make the following HTTP requests, the httpie tool was used:
- POST /places
http POST :8080/places name="Place" state="State"
HTTP/1.1 200 OK
Content-Length: 129
Content-Type: application/json
{
"createdAt": "2023-04-20T19:00:07.241632",
"name": "Place",
"slug": "place",
"state": "State",
"updatedAt": "2023-04-20T19:00:07.241632"
}
- GET /places/{id}
http :8080/places/1
HTTP/1.1 200 OK
Content-Length: 129
Content-Type: application/json
{
"createdAt": "2023-06-07T14:45:39.693689",
"name": "Place",
"slug": "place",
"state": "State",
"updatedAt": "2023-06-07T14:45:39.693689"
}
- GET /places?name=?
http :8080/places name==PLACE
HTTP/1.1 200 OK
Content-Type: application/json
transfer-encoding: chunked
[
{
"createdAt": "2023-06-07T14:45:39.693689",
"name": "Place",
"slug": "place",
"state": "State",
"updatedAt": "2023-06-07T14:45:39.693689"
}
]
- PATCH /places/{id}
http PATCH :8080/places/1 name='New Name' state='New State'
HTTP/1.1 200 OK
Content-Length: 142
Content-Type: application/json
{
"createdAt": "2023-06-07T14:45:39.693689",
"name": "New Name",
"slug": "new-name",
"state": "New State",
"updatedAt": "2023-06-07T14:53:21.671129345"
}