A simple checkout system written in node.js
- NODE:
>= 10
- YARN:
1.9.4
- POSTGRES:
9.6
- DATABASE
# clone the project
git clone https://github.com/avdkishore/express-boilerplate.git && cd express-boilerplate
# install the dependencies
yarn
# start the project
yarn start
# test
yarn test
- This starts the server on the port 5200
- database seeds are located in
/src/sql/seeds
. These need to be run in the database
Fetch all the available products
curl -X GET http://localhost:5200/api/v1/products
Get the final price for the products added to checkout
curl -X POST http://localhost:5200/api/v1/products/price \
-H 'Accept: */*' \
-H 'Content-Type: application/json' \
-d '{
"customer": "Facebook",
"items": [{ "type": "medium", "qty": 6 }]
}'
Get all the available offers for a customer
curl -X GET 'http://localhost:5200/api/v1/offers?customer=Facebook'
Create new offer
curl -X POST http://localhost:5200/api/v1/offers?auth=true&admin=true \
-H 'Content-Type: application/json' \
-d '{
"customer": "TCS",
"description": "some desc",
"type": "discount",
"value": { "product": "small", "finalPrice": "299.99" }
}'