travel-api
Travel API
Description
API developed for a code challenge built using Crystal, Kemal, Jennifer, and Postgres. The objective of the API is to register travel plans using locations from the Rick and Morty universe. In addition to registration, it's possible to retrieve the registered data and use optimization and expansion parameters to return organized results based on data present in the external "Rick and Morty API."
🔨 Features
-
Get(/travel_plans)
: to retrieve all plans from the database. -
Get(/travel_plans/:id)
: to retrieve the plan with the specified ID. -
Post(/travel_plans)
: to save new plans. The request body is a JSON object like:{ "travel_stops": [1,2] }
-
Put(/travel_plans/:id)
: to update the plan with the specified ID. The body is a JSON object like:{ "travel_stops": [1,2,4,6] }
-
Delete(/travel_plans/:id)
: to delete the plan with the specified ID.
Additional features:
-
Optimization
: The GET routes accept the 'optimize' parameter to adjust the order of the 'travel_stops' array based on popularity criteria. -
Expansion
: The GET routes accept the 'expand' parameter to provide additional details (name, type, dimension) for each 'travel_stop' in the response. Example usage: /travel_plans/1?optimize=true&expand=true
⚙️ Configuration
To use this application, simply download the project or clone this repository. Once done, navigate to the root directory and execute the following command in the terminal:
docker-compose up
Please ensure that you have Docker properly installed on your local environment.
✔️ Techniques and Technologies Used
Crystal
Kemal
Jennifer ORM
Postgres
Docker
🔗 Credits
Crystal-lang
: https://crystal-lang.org/reference/1.8/database/index.htmlRick and Morty API
: https://rickandmortyapi.com/Kemal
: https://crystal-lang.org/reference/1.8/database/index.htmlJennifer
: https://crystal-lang.org/reference/1.8/database/index.html
😄 Author
Jônathan Faria
travel-api
- 0
- 0
- 0
- 0
- 4
- 7 months ago
- September 26, 2023
MIT License
Sun, 19 May 2024 21:59:21 GMT