View on GitHub

car_website_backend

Develop a backend for Car sales company. This can be generalized to any product selling backend. Develop REST and GraphQL APIs, also focuses on how to secure, consume, document, and test those APIs and web services. The API documentation is developed using Swagger.

Vehicles API

A Spring Data Rest micro-service to maintain vehicle data and to provide a complete view of vehicle details including price and address.

Classes and packages

pricing.endpoint=http://localhost:8082
maps.endpoint=http://localhost:9191

#Eureka
spring.application.name=vehicles-api
eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka/
instance.preferIpAddress=true

Run the application

To properly run this application we need to first start the boggle-maps API and the pricing-service API.

$ mvn clean package
$ java -jar target/vehicles-api-0.0.1-SNAPSHOT.jar

Alternatively, we can import it our IDE and run the main class VehiclesApiApplicaion.

Using Swagger to test the application

Swagger UI: http://localhost:8080/swagger-ui.html

Create a Vehicle

POST /cars

{
   "condition":"USED",
   "details":{
      "body":"sedan",
      "model":"Impala",
      "manufacturer":{
         "code":101,
         "name":"Chevrolet"
      },
      "numberOfDoors":4,
      "fuelType":"Gasoline",
      "engine":"3.6L V6",
      "mileage":32280,
      "modelYear":2018,
      "productionYear":2018,
      "externalColor":"white"
   },
   "location":{
      "lat":40.73061,
      "lon":-73.935242
   }
}

Retrieve a Vehicle

GET /cars/{id}

This feature retrieves the Vehicle data from the database and access the Pricing Service and Boogle Maps to enrich the Vehicle information to be presented

Update a Vehicle

PUT /cars/{id}

{
   "condition":"USED",
   "details":{
      "body":"sedan",
      "model":"Impala",
      "manufacturer":{
         "code":101,
         "name":"Chevrolet"
      },
      "numberOfDoors":4,
      "fuelType":"Gasoline",
      "engine":"3.6L V6",
      "mileage":32280,
      "modelYear":2018,
      "productionYear":2018,
      "externalColor":"white"
   },
   "location":{
      "lat":40.73061,
      "lon":-73.935242
   }
}

Delete a Vehicle

DELETE /cars/{id}