Get discounts on products by using coupon codes. I've built two microservices that work together to make this happen: a product microservice and a coupon microservice.
This project consists of two microservices and a MySQL database. The microservices are deployed on AWS Elastic Beanstalk while the database is hosted on Amazon RDS.
This microservice exposes the following endpoints:
/coupons- POST: Creates a new coupon (all entries in database should have a unique coupon code)/couponsall- GET: Get all available coupons/coupons/{code}- GET: Retrieve coupon with given code
- POST
/coupons{ "code": "{code}", "discount": 30, "expDate": "12/12/2024" }
Coupon microservice is deployed on AWS Elastic Beanstalk at
http://Couponmicroservice-env.eba-hsrwim8p.eu-west-1.elasticbeanstalk.com
This microservice exposes the following endpoints:
/products- POST: Creates new product entry and applies any applicable discount based on coupon code provided
- POST
/products{ "name":"Corsair VENGEANCE RGB PRO 32GB ", "description": "Corsair VENGEANCE RGB PRO 32GB details.", "price":100, "couponCode": "D15CODE" }
Product microservice is deployed on AWS Elastic Beanstalk at
http://Productmicroservice-env.eba-tx6fajs8.eu-west-1.elasticbeanstalk.com
Database is available on Amazon RDS
productcouponservice.cgbgpizjxgbf.eu-west-1.rds.amazonaws.com
| id | code | discount | exp_date |
|---|---|---|---|
| 1 | codeName | 50 | 12/12/2025 |
| id | name | description | price |
|---|---|---|---|
| 1 | productName | product Description | 45 |
Want to use Dockerized version instead?
$ git clone https://github.com/Macarena-Chang/couponMicroservice.git
A docker-compose.yaml has been provided.
$ docker-compose up
http://localhost:9091/coupons- POST: Creates a new coupon (all entries in database should have a unique coupon code)http://localhost:9091/couponsall- GET: Get all available couponshttp://localhost:9091/coupons/{code}- GET: Retrieve coupon with given code
- POST
/coupons{ "code": "{code}", "discount": 30, "expDate": "12/12/2024" }
http://localhost:9090/products- POST: Creates new product entry and applies any applicable discount based on coupon code provided
- POST
/products{ "name":"Corsair VENGEANCE RGB PRO 32GB ", "description": "Corsair VENGEANCE RGB PRO 32GB details.", "price":100, "couponCode": "D15CODE" }