This is a full stack single seller ecommerce website that is being built using express js as backend, nextjs as frontend and mongoDB as database.
/api/auth/user/register
{
"name":"Bishal Niroula",
"email":"bishal@bishal.com",
"password":"bishal12345"
}
{
"status": "success",
"message": "User regestered."
}
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
/api/auth/user/login
{
"email":"bishal@bishal.com",
"password":"bishal12345"
}
{
"status": "success",
"message": "You have been logged in as Bishal Niroula"
}
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
/api/auth/admin/logout
{
"status": "success",
"message": "You have been logged out"
}
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
/api/auth/admin/login
{
"email": "niroulabishal199@gmail.com",
"password":"niroulabishal199"
}
{
"status": "success",
"message": "Please verify your otp to login"
}
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
/api/auth/admin/login/verify-otp
{
"email": "niroulabishal199@gmail.com",
"password":"niroulabishal199",
"otp":"220"
}
{
"status": "success",
"message": "You have been logged in as admin."
}
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
/api/auth/admin/login/resend-otp
{
"email" : "niroulabishal199@gmail.com",
"password":"niroulabishal199"
}
{
"status": "success",
"message": "OTP resent successfully"
}
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
/api/auth/admin/logout
{
"status": "success",
"message": "You have been logged out"
}
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
/api/books/admin/add
{
"title":"Title of the book 5",
"price":"201",
"category":"EDUCATIONAL",
"description" :"This is the description of the book.",
"stock":"5"
}
{
"title": "Title of the book 5",
"price": 201,
"category": "EDUCATIONAL",
"description": "This is the description of the book.",
"image": "/images/books/default.png",
"stock": 5,
"_id": "62c72de0d675b843c2dd50af",
"reviews": [],
"__v": 0
}
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
/api/books/admin/update/:id
{
"price": "250"
}
{
"_id": "62c6d3fd1fa4dd39f0c58a69",
"title": "Title of the book 2",
"price": 250,
"category": "EDUCATIONAL",
"description": "This is the description of the book.",
"image": "/images/books/default.png",
"stock": 5,
"reviews": [
{
"userId": "62c48d92e348918233fb65a2",
"review": "Very nice book",
"_id": "62c6da7344883da20c123f5c"
}
],
"__v": 0
}
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
/api/books/
[
{
"_id": "62c6d3701fa4dd39f0c58a66",
"title": "Title of the book",
"price": 200,
"category": "COMICS",
"description": "This is the description of the book.",
"image": "/images/books/default.png",
"stock": 5
},
{
"_id": "62c6d3fd1fa4dd39f0c58a69",
"title": "Title of the book 2",
"price": 250,
"category": "EDUCATIONAL",
"description": "This is the description of the book.",
"image": "/images/books/default.png",
"stock": 5
},
{
"_id": "62c6ea460fa77a6bb553d770",
"title": "Title of the book 3",
"price": 201,
"category": "EDUCATIONAL",
"description": "This is the description of the book.",
"image": "/images/books/default.png",
"stock": 5
},
{
"_id": "62c6ea9e0fa77a6bb553d774",
"title": "Title of the book 4",
"price": 201,
"category": "EDUCATIONAL",
"description": "This is the description of the book.",
"image": "/images/books/default.png",
"stock": 5
},
{
"_id": "62c6eabd0fa77a6bb553d77b",
"title": "Title of the book 5",
"price": 201,
"category": "EDUCATIONAL",
"description": "This is the description of the book.",
"image": "/images/books/default.png",
"stock": 5
},
]
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
/api/books/:id
{
"_id": "62c6d3701fa4dd39f0c58a66",
"title": "Title of the book",
"price": 200,
"category": "COMICS",
"description": "This is the description of the book.",
"image": "/images/books/default.png",
"stock": 5,
"reviews": [],
"__v": 0
}
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
/api/books/category/:category
[
{
"_id": "62c6d3fd1fa4dd39f0c58a69",
"title": "Title of the book 2",
"price": 250,
"category": "EDUCATIONAL",
"description": "This is the description of the book.",
"image": "/images/books/default.png",
"stock": 5,
"reviews": [
{
"userId": "62c48d92e348918233fb65a2",
"review": "Very nice book",
"_id": "62c6da7344883da20c123f5c"
}
],
"__v": 0
},
{
"_id": "62c6ea9e0fa77a6bb553d774",
"title": "Title of the book 4",
"price": 201,
"category": "EDUCATIONAL",
"description": "This is the description of the book.",
"image": "/images/books/default.png",
"reviews": [
{
"userId": "62c48d92e348918233fb65a2",
"review": "Very nice book",
"_id": "62c6ea9e0fa77a6bb553d775"
}
],
"stock": 5,
"__v": 0
},
{
"_id": "62c6eabd0fa77a6bb553d77b",
"title": "Title of the book 5",
"price": 201,
"category": "EDUCATIONAL",
"description": "This is the description of the book.",
"image": "/images/books/default.png",
"reviews": [
{
"userId": "62c48d92e348918233fb65a2",
"review": "Very nice book",
"_id": "62c6eabd0fa77a6bb553d77c"
}
],
"stock": 5,
"__v": 0
},
{
"_id": "62c72dc5d675b843c2dd50ab",
"title": "Title of the book 5",
"price": 201,
"category": "EDUCATIONAL",
"description": "This is the description of the book.",
"image": "/images/books/default.png",
"reviews": [
{
"userId": "62c48d92e348918233fb65a2",
"review": "Very nice book",
"_id": "62c72dc5d675b843c2dd50ac"
}
],
"stock": 5,
"__v": 0
},
]
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
/api/cart/add/:id
{
"status": "success",
"message": "Item added to cart successfully"
}
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
/api/cart/remove/:id
{
"status": "success",
"message": "Item removed from cart successfully"
}
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃