Backend services for Sugar Cosmetics Clone
https://api-sugarcosmetics.vercel.app/
- Node JS, Express JS, MongoDB, JWT, Razorpay API
GET /api/products
Parameter | Type | Description |
---|---|---|
Authorization Header |
Bearer Token |
Optional wishlist status of a user can be retrived by passing this |
GET /api/products?category=${category}
Parameter | Type | Description |
---|---|---|
category |
string |
Required. category to fetch |
GET /api/products/${Id}
Parameter | Type | Description |
---|---|---|
Id |
string |
Required. Id to fetch |
GET /api/products?category=${category}?sort=asc
GET /api/products?category=${category}?sort==dsc
Parameter | Type | Description |
---|---|---|
sort |
string |
Required. sort dependency to fetch |
GET /api/products?category=${category}&filter=any1%any2%any3%any4
Parameter | Type | Description |
---|---|---|
filter |
string |
Required. filter value to fetch |
GET /api/products/Search?q=${query}
Parameter | Type | Description |
---|---|---|
query |
string |
Required. query value to fetch |
GET /api/products/search?q=${query}&sort=asc/dsc
Parameter | Type | Description |
---|---|---|
query |
string |
Required. query value to fetch |
sort |
string |
Required. sort value to fetch |
GET /api/products/search?q=${query}&filter=any1%any2%any3%any4
Parameter | Type | Description |
---|---|---|
query |
string |
Required. query value to fetch |
filter |
string |
Required. filter value value should be same as products filter value |
POST /api/account/register
Required | Type | Description |
---|---|---|
body |
json |
body should have the properties { name, email, password } |
POST /api/account/login
Required | Type | Description |
---|---|---|
body |
json |
body should have the properties { email, password } to fetch |
response : {
name: ***,
email: ***,
token: ***
}
POST /api/account/token
Required | Type | Description |
---|---|---|
authorization header |
object |
authorization header should have token type as Bearer and a token separated by a space in a single string |
< e.g >
headers: {
"authorization": `Bearer ${token}`
}
response : {
name: ***,
email: ***,
token: ***
}
POST /api/account/exist
Required | Type | Description |
---|---|---|
body |
json |
body should have the properties { email } |
POST /api/otp/send
Required | Type | Description |
---|---|---|
body |
json |
body should have the properties { email } |
POST /api/otp/verify
Required | Type | Description |
---|---|---|
body |
json |
body should have the properties { email, otp, hashkey } |
POST /api/cart
Required | Type | Description |
---|---|---|
body |
json |
body should have the product |
authorization header |
object |
authorization header should have token type as Bearer and a token separated by a space in a single string |
GET /api/cart
Required | Type | Description |
---|---|---|
authorization header |
object |
authorization header should have token type as Bearer and a token separated by a space in a single string |
PATCH /api/cart/${Id}
Required | Type | Description |
---|---|---|
Id |
string |
Required. Product Id to patch |
authorization header |
object |
authorization header should have token type as Bearer and a token separated by a space in a single string |
DELETE /api/cart/${Id}
Required | Type | Description |
---|---|---|
Id |
string |
Required. Product Id to delete |
authorization header |
object |
authorization header should have token type as Bearer and a token separated by a space in a single string |
DELETE /api/cart/clear/all
Required | Type | Description |
---|---|---|
authorization header |
object |
authorization header should have token type as Bearer and a token separated by a space in a single string |
POST /api/wishlist
Required | Type | Description |
---|---|---|
body |
json |
body should have the product |
authorization header |
object |
authorization header should have token type as Bearer and a token separated by a space in a single string |
GET /api/wishlist
Required | Type | Description |
---|---|---|
authorization header |
object |
authorization header should have token type as Bearer and a token separated by a space in a single string |
GET /api/wishlist/exist/${Id}
Required | Type | Description |
---|---|---|
Id |
string |
Required. Product Id to delete |
authorization header |
object |
authorization header should have token type as Bearer and a token separated by a space in a single string |
DELETE /api/wishlist/${Id}
Required | Type | Description |
---|---|---|
Id |
string |
Required. Product Id to delete |
authorization header |
object |
authorization header should have token type as Bearer and a token separated by a space in a single string |
POST /api/address
Required | Type | Description |
---|---|---|
body |
json |
body should have the fields {name, number, flatno, locality, pincode, city, state} |
authorization header |
object |
authorization header should have token type as Bearer and a token separated by a space in a single string |
GET /api/address
Required | Type | Description |
---|---|---|
authorization header |
object |
authorization header should have token type as Bearer and a token separated by a space in a single string |
PATCH /api/address/${Id}
Required | Type | Description |
---|---|---|
Id |
string |
Required. Address Id to patch |
authorization header |
object |
authorization header should have token type as Bearer and a token separated by a space in a single string |
DELETE /api/address/${Id}
Required | Type | Description |
---|---|---|
Id |
string |
Required. Product Id to delete |
authorization header |
object |
authorization header should have token type as Bearer and a token separated by a space in a single string |
POST /api/order
Required | Type | Description |
---|---|---|
body |
json |
body should have the fields {orderId, amount, created, delivery, status, products} |
authorization header |
object |
authorization header should have token type as Bearer and a token separated by a space in a single string |
GET /api/order
Required | Type | Description |
---|---|---|
authorization header |
object |
authorization header should have token type as Bearer and a token separated by a space in a single string |
POST /api/payment/create
Required | Type | Description |
---|---|---|
body |
json |
body should have the fields {amount} |
GET /api/payment/verify
Required | Type | Description |
---|---|---|
body |
json |
body should have the fields { razorpay_order_id, razorpay_payment_id, razorpay_signature } |
To run this project, you will need to add the following environment variables to your .env file
JWT_SECRET_KEY
- Json web token secret key(any)
MONGO_URI
- MongoDB connection string
KEY_ID
- Razorpay key_id
KEY_SECRET
- Razorpay key_secret
Clone the project
git clone https://github.com/Arun-ez/sugar_cosmetics_backend.git
npm i
npm start
For support, email arunshaw433@gmail.com