Skip to content

cloud-wave-best-zizon/order-service-springboot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Order API 실행 예시

아래 예시는 컨테이너 실행과 주문 생성/조회 API 호출 방법을 담고 있습니다.


1) 컨테이너 실행

docker run -d --pull=always --name cw-order -p 8083:8080 \
  -e AWS_REGION=ap-northeast-2 \
  -e AWS_ACCESS_KEY_ID=YOUR_KEY \
  -e AWS_SECRET_ACCESS_KEY=YOUR_SECRET \
  gyuseon25/cw-order:v1

위 매핑은 호스트 8083 → 컨테이너 8080 입니다.
따라서 호스트에서 호출할 땐 http://localhost:8083를 사용하세요. (아래 예시에서 둘 다 표기)


2) 주문 생성 (POST /api/orders)

curl -X POST http://localhost:8083/api/orders   -H "Content-Type: application/json"   -d '{
    "userId": "user-123",
    "idempotencyKey": "idem-0001",
    "items": [
      { "productId": 101, "productName": "맥북 프로 14", "quantity": 1, "price": 2690000 }
    ]
  }'

예시 응답:

{"orderId":1754968039649,"status":"PENDING","message":"Order created successfully"}

실행 환경에 따라 8080으로 띄운 경우에는 다음처럼 호출할 수 있습니다:

curl -X POST http://localhost:8080/api/orders >   -H "Content-Type: application/json" >   -d '{
    "userId": "user-123",
    "idempotencyKey": "idem-0001",
    "items": [
      { "productId": 101, "productName": "맥북 프로 14", "quantity": 1, "price": 2690000 }
    ]
  }'

3) 주문 조회 (GET /api/orders/{id})

# 권장: 호스트 8083 사용
curl http://localhost:8083/api/orders/1754968039649

8080을 사용 중이라면:

curl http://localhost:8080/api/orders/1754968039649

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors