A simple e-commerce application
API is deployed locally
- NodeJS - Runtime Environment
- ExpressJs - Web Application Framework
- yarn - Package Manager
- Mongo DB - Application database
- Babel - Compiler for ES6 Javascript
- Sign up an account
- Login to the account
- View available products
- Post their own products
- View a single product
- Add items to their shopping cart
- View all products items in their cart
- Remove a specific item from cart
- Make an order
- Cancel an order
- Get all order
- Fulfill an order
- Clone the repository e-commerce-app.
- Run
yarn install
to install packages. - Setup environment variables in your
.env
.- See
.env.sample
for sample variable keys
- See
- Run
docker-compose up
to build the docker containr and run the application. - Default
base_url
is athttp://localhost/api/v1
url - http://localhost/api/v1/users
method: POST
request body: {
"firstName": "firstName",
"firstName": "firstName",
"email": "email@mail.com",
"password": "1234567890",
"phone": "08012345678800"
}
url - http://localhost/api/v1/users
method: GET
request body: {
"email": "email@mail.com",
"password": "1234567890",
}
url - http://localhost/api/v1/products
method: POST
Authorization: Bearer {{token}}
request body: {
"name": "53\" Smart TV",
"category": "electronics",
"description": "Smart TV",
"price": "85,000"
}
url - http://localhost/api/v1/products
method: GET
url - http://localhost/api/v1/product/{{productId}}
method: GET
url - http://localhost/api/v1/cart
method: GET
Authorization: Bearer {{token}}
url - http://localhost/api/v1/cart
method: POST
Authorization: Bearer {{token}}
request body: {
"productId": "productId",
"quantity": 1
}
url - http://localhost/api/v1/cart
method: PATCH
Authorization: Bearer {{token}}
request body: {
"productId": ["productId-1", "productId-2", ...]
}
url - http://localhost/api/v1/order
method: GET
Authorization: Bearer {{token}}
url - http://localhost/api/v1/order
method: POST
Authorization: Bearer {{token}}
request body: {
"cartId": "cart-id"
}
url - http://localhost/api/v1/fulfill/{{orderId}}
method: POST
Authorization: Bearer {{token}}
url - http://localhost/api/v1/order/{{orderId}}
method: DELETE
Authorization: Bearer {{token}}
- Postman - API Toolchain
- Rest-Client - VS Code http rest client
- After installing as shown above
- Navigate to
http://localhost/api/v1
in Postman to access the application endpoints.
- After installation
- yarn test
- It will lint code, run test and display coverage data as generated by nyc
babe-node helps to compile es6 codes to es5 before for production deployment.