This is a Java MicroService on Spring Boot.
Requirements: JDK 11, Maven, MySQL with DDL Access.
Run the Database Scripts present in /scripts folder.
Open the Application.yaml file and edit the MySQL connection details.
Open any terminal or command prompt and type:
mvn clean install
Once this command execution is completed, please go inside the /target folder and run the generated jar (catalog-service-0.0.1.jar) using this command:
java -jar catalog-service-0.0.1.jar &
Once Application is running, hit below url
http://localhost:8080/swagger-ui/#/
In case, swagger doesn't open up, please use these curl requests:
curl --request GET --url http://localhost:8080/
curl --request POST --url http://localhost:8080/category/ --header 'content-type: application/json' --data '{"name": "Cloth", "description": "Wear"}'
NOTE:- After Category is Created, Please save the categoryId that you received in response for Creating Category Attributes and for linking product to category
curl -X POST http://localhost:8080/category/attribute -H 'content-type: application/json' -d '{ "name": "Color", "description": "Color of Cloth", "categoryId": 711577 }'
curl -X GET http://localhost:8080/category/711577/attribute
curl -X POST http://localhost:8080/product -H 'content-type: application/json' -d '{ "name": "Wrangler Shirt", "description": "Clothing Item", "categoryId": 711577, "categoryAttributes": [ { "categoryId": 711577, "attributeId": 145684, "attributeName": "Color", "attributeValue": "BLACK" } ] }'
NOTE:- After Product is Created, Please save the productId that you received in response for fetching productInfo by productId
curl -X GET http://localhost:8080/product/92403996