Skip to content

ldmtam/ecommerce-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sequence diagram

Create new product

Create new product

Get product

Get product

Search product

Search product

Get user activities

Get user activities

How to run

Firstly, run the following command to run necessary components

make start-docker

Please make sure those ports are available

MySQL: 3306
Adminer: 8080
Zookeeper: 2181
Kafka: 9092
Application: 3000

Secondly, start the application

make run-local

When finished, execute the following command to cleanup containers

make stop-docker

cURL

Create new product

curl --location --request POST 'localhost:3000/api/v1/products' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "name": "Ultraboost 22 shoes",
        "price": 250
    }'
curl --location --request POST 'localhost:3000/api/v1/products' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "name": "Ultraboost 4DFWD shoes",
        "price": 300
    }'
curl --location --request POST 'localhost:3000/api/v1/products' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "name": "Stan Smith shoes",
        "price": 200
    }'

Get product by id

curl --location --request GET 'localhost:3000/api/v1/products/1' \
    --header 'Content-Type: application/json' \
    --header 'Cookie: user_id=123' \
    --data-raw ''
curl --location --request GET 'localhost:3000/api/v1/products/2' \
    --header 'Content-Type: application/json' \
    --header 'Cookie: user_id=456' \
    --data-raw ''

Seach product by names

curl --location --request GET 'localhost:3000/api/v1/products/seachByName/boost' \
    --header 'Cookie: user_id=123' \
    --data-raw ''
curl --location --request GET 'localhost:3000/api/v1/products/seachByName/shoe' \
    --header 'Cookie: user_id=123' \
    --data-raw ''

Get customer activities

curl --location --request GET 'localhost:3000/api/v1/customer_activities/123' \
    --data-raw ''
curl --location --request GET 'localhost:3000/api/v1/customer_activities/456' \
    --data-raw ''
curl --location --request GET 'localhost:3000/api/v1/customer_activities/123/actions/VIEW_PRODUCT' \
    --data-raw ''

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published