https://github.com/thebishalniroula/kitaab-fullstack-bookstore
Kitaab is a single vendor online book selling platform made with NextJS, Express, and MongoDB
https://github.com/thebishalniroula/kitaab-fullstack-bookstore
bookstore bookstorewebsite expressjs mongodb nextjs
Last synced: about 1 month ago
JSON representation
Kitaab is a single vendor online book selling platform made with NextJS, Express, and MongoDB
- Host: GitHub
- URL: https://github.com/thebishalniroula/kitaab-fullstack-bookstore
- Owner: thebishalniroula
- Created: 2022-07-06T14:28:45.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-04T06:43:01.000Z (almost 3 years ago)
- Last Synced: 2023-05-10T15:04:27.367Z (over 2 years ago)
- Topics: bookstore, bookstorewebsite, expressjs, mongodb, nextjs
- Language: JavaScript
- Homepage:
- Size: 4.27 MB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Project: full stack single seller ecoomerce
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.
# Backend routes
## End-point: user register
### Method: POST
>```
>/api/auth/user/register
>```
### Body (**raw**)
```json
{
"name":"Bishal Niroula",
"email":"bishal@bishal.com",
"password":"bishal12345"
}
```
### Response: 200
```json
{
"status": "success",
"message": "User regestered."
}
```
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
## End-point: user login
### Method: POST
>```
>/api/auth/user/login
>```
### Body (**raw**)
```json
{
"email":"bishal@bishal.com",
"password":"bishal12345"
}
```
### Response: 200
```json
{
"status": "success",
"message": "You have been logged in as Bishal Niroula"
}
```
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
## End-point: user logout
### Method: POST
>```
>/api/auth/admin/logout
>```
### Response: 200
```json
{
"status": "success",
"message": "You have been logged out"
}
```
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
## End-point: admin login
### Method: POST
>```
>/api/auth/admin/login
>```
### Body (**raw**)
```json
{
"email": "niroulabishal199@gmail.com",
"password":"niroulabishal199"
}
```
### Response: 200
```json
{
"status": "success",
"message": "Please verify your otp to login"
}
```
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
## End-point: verify-otp
### Method: POST
>```
>/api/auth/admin/login/verify-otp
>```
### Body (**raw**)
```json
{
"email": "niroulabishal199@gmail.com",
"password":"niroulabishal199",
"otp":"220"
}
```
### Response: 200
```json
{
"status": "success",
"message": "You have been logged in as admin."
}
```
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
## End-point: resend-otp
### Method: POST
>```
>/api/auth/admin/login/resend-otp
>```
### Body (**raw**)
```json
{
"email" : "niroulabishal199@gmail.com",
"password":"niroulabishal199"
}
```
### Response: 200
```json
{
"status": "success",
"message": "OTP resent successfully"
}
```
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
## End-point: admin logout
### Method: POST
>```
>/api/auth/admin/logout
>```
### Response: 200
```json
{
"status": "success",
"message": "You have been logged out"
}
```
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
## End-point: add book
### Method: POST
>```
>/api/books/admin/add
>```
### Body (**raw**)
```json
{
"title":"Title of the book 5",
"price":"201",
"category":"EDUCATIONAL",
"description" :"This is the description of the book.",
"stock":"5"
}
```
### Response: 200
```json
{
"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
}
```
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
## End-point: update book
### Method: PATCH
>```
>/api/books/admin/update/:id
>```
### Body (**raw**)
```json
{
"price": "250"
}
```
### Response: 200
```json
{
"_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
}
```
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
## End-point: books
### Method: GET
>```
>/api/books/
>```
### Response: 200
```json
[
{
"_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
},
]
```
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
## End-point: book by id
### Method: GET
>```
>/api/books/:id
>```
### Response: 200
```json
{
"_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
}
```
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
## End-point: books by category
### Method: GET
>```
>/api/books/category/:category
>```
### Response: 200
```json
[
{
"_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
},
]
```
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
## End-point: add to cart
### Method: POST
>```
>/api/cart/add/:id
>```
### Response: 200
```json
{
"status": "success",
"message": "Item added to cart successfully"
}
```
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃
## End-point: remove from cart
### Method: DELETE
>```
>/api/cart/remove/:id
>```
### Response: 200
```json
{
"status": "success",
"message": "Item removed from cart successfully"
}
```
⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃