The project builds RESTful APIs using Node.js, Express and Mongoose,... 🔥⭐
Clone the repo 🫶 🫡 :
git clone https://github.com/libeyondea/backend-node-express.git
cd backend-node-express
Install the dependencies:
npm install
Set the environment variables:
cp .env.example .env
# open .env and modify the environment variables
Commands 📜 | Environment variables 🌐 | Project Structure 🧱 | api endponts 🐉 |
---|---|---|---|
Commands | Environment Variables | Project Structure | API Endpoints |
Running in development:
npm start
# or
npm run dev
Running in production:
# start
npm run prod
The environment variables can be found and modified in the .env
file.
#Environment
NODE_ENV=development
NODE_ENV=production
# Port
PORT = 3000
# Host
BASE_URL = localhost:3000
# Mongo DB
db_user = your user name of atlas db
db_password = your password
db_name = your db name
db_url= mongodb+srv://db_user:db_password@cluster0.qjpxegw.mongodb.net/db_name?retryWrites=true&w=majority
local_db_url = mongodb://127.0.0.1:27017/db_name
# JWT
JWT_SECRET =
# Token expires
JWT_EXPIRE =
JWT_COOKIE_EXPIRE =
# SMTP configuration
EMAIL_HOST = smtp.gmail.com
EMAIL_PORT = 465
EMAIL_USER =
EMAIL_PASSWORD =
├── E-COMMERCE-CHARITY
│ ├── server.js
│ ├── package.json
│ ├── package-lock.json
| ├── config.env
│ ├── config
│ │ ├── database.js
│ ├── models
│ │ ├── userModel.js
│ │ ├── productModel.js
│ │ ├── categoryModel.js
│ │ ├── brandModel.js
│ │ ├── cartModel.js
│ │ └── orderModel.js
│ ├── middlewares
│ │ ├── auth.js
│ │ ├── error.js
│ │ ├── uploadImage.js
│ │ └── validator.js
│ ├── utils
│ │ ├── validators
│ │ │ ├── userValidator.js
│ │ │ ├── authValidator.js
│ │ │ ├── productValidator.js
│ │ │ ├── categoryValidator.js
│ │ │ └── brandValidator.js
│ │ ├── ApiError.js
│ │ ├── apiFeatures.js
│ │ ├── sendEmail.js
│ ├── controllers
│ │ ├── handleFactory.js
│ │ ├── userController.js
│ │ ├── auth.js
│ │ ├── productService.js
│ │ ├── categoryService.js
│ │ ├── brandService.js
│ │ ├── cartService.js
│ │ └── orderService.js
│ ├── routes
│ │ ├── auth.js
│ │ ├── userRoute.js
│ │ ├── productRoute.js
│ │ ├── categoryRoute.js
│ │ ├── brandRoute.js
│ │ ├── cartRoute.js
│ │ └── orderRoute.js
│ ├── uploads
│ │ ├── brands
│ │ ├── users
│ │ ├── categories
│ │ └── products
└── .gitignore
List of available routes:
Auth routes:
POST auth/register
- Signup
POST auth/login
- Signin
POST auth/forgot-password
- Send reset password email
POST auth/reset-password
- Reset password
User routes:
POST /users
- Create a user
GET /users
- Get all users
GET /users/:id
- Get user
PUT /users/:id
- Update user
DELETE /users/:id
- Delete user
Product routes:
POST /products
- Create a product
GET /products
- Get all products
GET /products/:id
- Get product
PUT /products/:id
- Update product
DELETE /products/:id
- Delete product
Category routes:
POST /category
- Create a category
GET /category
- Get all categoryies
GET /category/:id
- Get category
PUT /category/:id
- Update category
DELETE /category/:id
- Delete category
brand routes:
POST /brands
- Create a brand
GET /brands
- Get all brands
GET /brands/:id
- Get brand
PUT /brands/:id
- Update brand
DELETE /brands/:id
- Delete brand
- Support it by clicking the ⭐ button on the upper right of this page. ✌️
Copyright (C) 2023 Z,H,N,M,Y Team ❤️