/milhasapi

API developed as resut of the 7th Back-end Challenge of Alura.

Primary LanguageJava

✈️ Milhas API

Docker Linux Spring MySQL Git VSCode

Aimeos logo

The goal is to provide information and resource related to possible travel destinations, showing photos, texts and also resources about testimonials from other travelers. In addition to integrating AI into your application.



🔍 Table Of Content

📜 About

API in development to the 7th Back-end Challenge of Alura.

Used Technologies:

  • Language: Java
  • Framework: Spring Boot
  • Migration Tool: Flywaydb
  • Documentation: SpringDoc Swagger
  • OpeanAI Integration: openai-java
  • Other libraries: Lombok, DataFaker
  • Database: MySQL
  • Development environment: Docker
  • Code Editor: VS Code

🎯 The Challenge

In this 7th Backend challenge, we are going to develop an API that will be integrated with Frontend. Our challenge is to provide information and resources from the database related to possible travel destinations, displaying photos and eye-catching text that encourages the user to want to visit that destination.

In addition, we will also provide resources on testimonials from other travelers and, finally, we will integrate AI into our application.

Project steps

  • First Week

    • Testimonial CRUD Create /depoimentos endpoint to perform CRUD operations.
    • Random Testimonials: Create depoimentos-home endpoint to show 3 random testimonials
    • CORS Enable CORS request from any origin on the development phase.
    • Test Verify the status code of GET, POST, PUT, DELETE of /depoimentos endpoint
  • Second Week

    • Destination CRUD Create /destinos endpoint to perform CRUD operations.
    • Search Destination by name.
    • Test destinos endpoint
  • Third and Fourth Week

    • Update destinos endpoint with the fields
      • id
      • Photo 1
      • Photo 2
      • Name
      • Meta (max 160 characters)
      • Description text (optional)
    • /destinos/{id} endpoint should retrieve
      • Photo 1
      • Photo 2
      • Name
      • Meta
      • Description text
    • AI integration to generate description about destination, in case of some destination has no description
    • Test destinos endpoint

👣 Walkthrough

Check my steps to develop this project here

📜 API Doc

This projects uses SpringDoc (Swagger) to generate API documentation. You can check it by runing the project and accessing swagger-ui

🚀 Running locally

# clone the repository
git clone https://github.com/ecureuill/milhasapi.git

# Navigate to the cloned directory
cd milhasapi

MilhasAPI uses MySQL as the database. Create a MySQL database, named milhasapi and update the database configuration in src/main/resources/application.properties file:

spring.datasource.url=jdbc:mysql://[URL]:[PORT]/milhasapi
spring.datasource.username=[USERNAME]
spring.datasource.password=[PASSWORD]

MilhasAPI is integrated to ChatGPT to generate destination description. Create an API key on openai platform and export it as environmet variable.

export OPENAI_KEY=123

Run the project

mvn spring-boot:run

To use this API, you can make HTTP requests to the provided endpoints using tools like cURL or Postman.