Coding assessment for M360ICT recruitment process.
To run this project on your local machine do follow the instructions
git clone https://github.com/MDAmir159/ecommerce-server.git
cd ecommerce-server
Necessary dependencies are inscribed in the package.json file. Now install the dependencies.
npm install
API_HOST = localhost
API_USER = root
API_PASSWORD =
API_DATABASE = crud_test
API_CONNECTION_LIMIT =
API_PORT = 5000
ACCESS_TOKEN_SECRET=
REFRESH_TOKEN_SECRET=
API_EMAIL =
API_EMAIL_PASSWORD =
BASE_LINK = http://localhost:5000/
Openup a phpmyadmin server. There is a crud_test.sql file is available in e-mail as an attachment. Import on your phpmyadmin server. Database name should be as inscribed in the .env file.
Now, start the project on your local machine.
npm run devStart
Openup POSTMAN app. There is a crud_test.postman_collection file is available in the attachment section of the email. Import it on your POSTMAN and there you can see necessary APIs to interact with the server.
GET /color
POST /color
Body | Type | Description |
---|---|---|
name |
string |
Required |
PATCH /color
Body | Type | Description |
---|---|---|
colorId |
integer |
Required |
name |
string |
Required |
DELETE /color/by_id
Body | Type | Description |
---|---|---|
colorId |
integer |
Required |
DELETE /color/by_name
Body | Type | Description |
---|---|---|
colorName |
string |
Required |
GET /size
POST /size
Body | Type | Description |
---|---|---|
name |
string |
Required |
PATCH /size
Body | Type | Description |
---|---|---|
sizeId |
integer |
Required |
name |
string |
Required |
DELETE /size/by_id
Body | Type | Description |
---|---|---|
sizeId |
integer |
Required |
DELETE /size/by_name
Body | Type | Description |
---|---|---|
sizeName |
string |
Required |
GET /category/adjacencyList
PATCH /category/updateCategoryStatus
Body | Type | Description |
---|---|---|
categoryId |
integer |
Required |
statusId |
integer |
Required |
POST /category/add_category
Body | Type | Description |
---|---|---|
name |
integer |
Required |
parent_id |
integer |
Required |
status_id |
integer |
Required |
PATCH /category/update_parentCategory
Body | Type | Description |
---|---|---|
targetParent |
integer |
Required |
replacedParent |
integer |
Required |
DELETE /category/delete_category
Body | Type | Description |
---|---|---|
categoryId |
integer |
Required |
GET /product/search_by_name
Body | Type | Description |
---|---|---|
productName |
string |
Required |
GET /product/product_details
Body | Type | Description |
---|---|---|
productId |
integer |
Required |
GET /product/productlist_by_category
Body | Type | Description |
---|---|---|
categoryId |
integer |
Required |
GET /product/productlist_by_category_and_attributes
Body | Type | Description |
---|---|---|
categoryId |
integer |
Required |
size_id |
integer |
optional |
color_id |
integer |
optional |
PATCH /product/update_product
Body | Type | Description |
---|---|---|
id |
integer |
Required |
name |
string |
Required |
color_id |
integer |
Required |
size_id |
integer |
Required |
leaf_category |
integer |
Required |
To run this project, you will need to add the following environment variables to your .env file
API_HOST
API_USER
API_PASSWORD
API_DATABASE
API_PORT
BASE_LINK