An exception occurred in the system when using the feign, can response the custom structure.
{"code": -1, "message": "system error", "data": null}
- JDK 1.8
- Clone this repository using
git clone
. - Open the cloned project.
- Import the
pom.xml
file from the root directory usingMaven Projects
. - Find each Application class to run each module.
- eureka
- gateway
- order-service
- product-service
- manager-web
- Case1: Success
POST http://localhost:8081/manager/order/create
Content-Type: application/json
{
"userId" : 1000,
"productId" : 1,
"num" : 1
}
- Case2: Fail, parameter validate error
POST http://localhost:8081/manager/order/create
Content-Type: application/json
{
"userId" : null,
"productId" : 1,
"num" : 1
}
- Case3: Fail, product not exist
POST http://localhost:8081/manager/order/create
Content-Type: application/json
{
"userId" : 1000,
"productId" : 3,
"num" : 1
}
- Case4: Fail, not enough stock
POST http://localhost:8081/manager/order/create
Content-Type: application/json
{
"userId" : 1000,
"productId" : 2,
"num" : 1
}