Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/umarnawaz33/eshop-web-api
This is web api for an ecommerce shop.
https://github.com/umarnawaz33/eshop-web-api
bcrypt expressjs json-web-token mongodb mongodbatlas mongoose nodejs
Last synced: about 1 month ago
JSON representation
This is web api for an ecommerce shop.
- Host: GitHub
- URL: https://github.com/umarnawaz33/eshop-web-api
- Owner: UmarNawaz33
- License: mit
- Created: 2021-10-04T11:02:59.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-04T12:59:27.000Z (over 3 years ago)
- Last Synced: 2024-11-25T00:27:11.776Z (about 2 months ago)
- Topics: bcrypt, expressjs, json-web-token, mongodb, mongodbatlas, mongoose, nodejs
- Language: JavaScript
- Homepage:
- Size: 179 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## About The Project
This is web api for an ecommerce store. This api covers major features of an ecommerce shop like user registration, product upload, categories, orders and authentication.## Getting Started
To run this project first you need to setup your enviroment for nodejs. After that you need to:
* Clone this project.
* Use `npm install` command to install all the packages.#### To Run Locally
* Setup and Configure mongb locally.
* Use `mongod` command to start mongodb server using terminal.
* Use `node app.js` command to start the node server on localhost.#### To Run on Server
* Setup and Configure mongodb atlas for your project.
* Setup and Configure server(heroku) for your app.
* Create and Update `.env` file accordingly.
* For Deployment, follow the guidelines provided by heroku or any other server you are using.#### Testing
This api is not hosted on live server for now. Some routes of api are protected so you will need to login/register before using them.
For testing the api you can use [Postman](https://www.postman.com/).### Built With
This application is built with the following:
* [Node JS](https://nodejs.org/en/)
* [Express JS](https://expressjs.com/)
* [MongoDb](https://www.mongodb.com/)
* [Mongoose](https://mongoosejs.com/)
* [MongoDb Atlas](https://www.mongodb.com/cloud/atlas)## API Endpoints
This api allows all CRUD operations and it has following endpoints:### User
* [User Model](https://github.com/UmarNawaz33/eshop-web-api/blob/main/models/user.js)
* [User Route](https://github.com/UmarNawaz33/eshop-web-api/blob/main/routes/users.js)Reuest Path Body Parameters Request Parameters Explanation
GET http://localhost:3000/api/v1/users - - get all users
GET http://localhost:3000/api/v1/users/:id - user id get user with id
GET http://localhost:3000/api/v1/users/get/count - - get user count
POST http://localhost:3000/api/v1/users all user fields - add user to database
POST http://localhost:3000/api/v1/users/register all user fields - register a user
POST http://localhost:3000/api/v1/users/login email, password - user login
DELETE http://localhost:3000/api/v1/users/:id - user id delete user with specified id### Category
* [Category Model](https://github.com/UmarNawaz33/eshop-web-api/blob/main/models/category.js)
* [Category Route](https://github.com/UmarNawaz33/eshop-web-api/blob/main/routes/categories.js)Reuest Path Body Parameters Request Parameters Explanation
GET http://localhost:3000/api/v1/categories - - get all categories
GET http://localhost:3000/api/v1/categories/:id - category id get category with id
PUT http://localhost:3000/api/v1/categories/:id name, icon, color category id update category
POST http://localhost:3000/api/v1/categories all category fields - add category to database
DELETE http://localhost:3000/api/v1/categories/:id - category id delete category with specified id### Product
* [Product Model](https://github.com/UmarNawaz33/eshop-web-api/blob/main/models/product.js)
* [Product Route](https://github.com/UmarNawaz33/eshop-web-api/blob/main/routes/products.js)Reuest Path Body Parameters Request Parameters Explanation
GET http://localhost:3000/api/v1/products - - get all products
GET http://localhost:3000/api/v1/products/:id - id get product with id
GET http://localhost:3000/api/v1/products/get/count - - get total product count
GET http://localhost:3000/api/v1/products/get/featured/:count - count get specified number of featured product
POST http://localhost:3000/api/v1/products all product fields, (product image upload) - add product to database
PUT http://localhost:3000/api/v1/products/:id category id, all product field, (product image upload) product id update product
PUT http://localhost:3000/api/v1/products//gallery-images/:id multiple product images upload product id add gallery images of product
DELETE http://localhost:3000/api/v1/products/:id - product id delete product with specified id### Order
* [Order Model](https://github.com/UmarNawaz33/eshop-web-api/blob/main/models/order.js)
* [Order Route](https://github.com/UmarNawaz33/eshop-web-api/blob/main/routes/orders.js)Reuest Path Body Parameters Request Parameters Explanation
GET http://localhost:3000/api/v1/orders - - get all orders
GET http://localhost:3000/api/v1/orders/:id - order id get order with id
GET http://localhost:3000/api/v1/orders/get/userorder/:userid - user id get all order of specific user
GET http://localhost:3000/api/v1/orders/get/totalsales - - get total sales
GET http://localhost:3000/api/v1/orders/get/count - - get order count
PUT http://localhost:3000/api/v1/orders/:id status order id update order status
POST http://localhost:3000/api/v1/orders all order fields, product, product quantity - add order to database
DELETE http://localhost:3000/api/v1/orders/:id - order id delete order with specified id## License
Distributed under the MIT License. See [LICENSE](https://github.com/UmarNawaz33/eshop-web-api/blob/main/LICENSE) for more information.
## Acknowledgements
* [body-parser](https://www.npmjs.com/package/body-parser)
* [express](https://www.npmjs.com/package/express)
* [mongoose](https://www.npmjs.com/package/mongoose)
* [bcryptjs](https://www.npmjs.com/package/bcryptjs)
* [cors](https://www.npmjs.com/package/cors)
* [dotenv](https://www.npmjs.com/package/dotenv)
* [express-jwt](https://www.npmjs.com/package/express-jwt)
* [jsonwebtoken](https://www.npmjs.com/package/jsonwebtoken)
* [morgan](https://www.npmjs.com/package/morgan)
* [multer](https://www.npmjs.com/package/multer)