/API

Primary LanguageJavaScript

Dawini Application 💉💊

localhost_4200_(Nest Hub Max)

RESTful API Node Express Mongoose Application about Medical organization called Dawini 👩‍💻 ⭐

The project builds RESTful APIs using Node.js, Express and Mongoose,... 🔥⭐

Manual Installation 📥👋 :

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

Table of Contents

Commands 📜 Environment variables 🌐 Project Structure 🧱 api endponts 🐉
Commands Environment Variables Project Structure API Endpoints

Commands

Running in development:

npm run start:dev

Running in production:

npm run start:prod

Environment Variables

The environment variables can be found and modified in the .env file.

#Environment 
NODE_ENV=development
NODE_ENV=production

# Port
PORT = 8000

# Host
BASE_URL = localhost:8000

# 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 = 

Project Structure

├── E-COMMERCE-MEDICAL
│   ├── app.js
│   ├── package.json
│   ├── package-lock.json
|   ├── .env
│   ├── config
│   │   ├── database.js
│   ├── models
│   │   ├── userModel.js
│   │   ├── itemModel.js
│   │   ├── newsItemModel.js
│   │   ├── cartModel.js
│   │   └── orderModel.js
│   ├── middlewares
│   │   ├── errorMiddleware.js
│   │   ├── uploadImageMiddleware.js
│   │   └── validatorMiddleware.js
│   ├── utils
│   │   ├── validators
│   │   │   ├── userValidator.js
│   │   │   ├── adminValidator.js
│   │   │   ├── authValidator.js
│   │   │   ├── itemValidator.js
│   │   │   ├── cartValidator.js
│   │   │   └── orderValidator.js
│   │   ├── ApiError.js
│   │   ├── apiFeatures.js
│   │   ├── sendEmail.js
|   |   ├── generateToken.js
|   |   ├── uploadImgCloudinary.js
│   ├── controllers
│   │   ├── handleFactory.js
│   │   ├── userController.js
│   │   ├── auth.js
│   │   ├── itemController.js
│   │   ├── newItemController.js
│   │   ├── addressController.js
│   │   ├── cartController.js
│   │   └── orderController.js
│   ├── router
│   │   ├── authRoute.js
│   │   ├── userRoute.js
│   │   ├── itemRoute.js
│   │   ├── newsItemRoute.js
│   │   ├── addressRoute.js
│   │   ├── cartRoute.js
│   │   └── orderRoute.js
│   ├── uploads
│   │   ├── profile
│   │   ├── items
└──  .gitignore

API Endpoints

List of available routes:

Auth routes:
POST auth/register - Signup
POST auth/login - Signin
POST auth/forgot-password - Send reset password email
PUT 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
PUT /users/changePassword/:id - Update change user password
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

News items:
POST /newsItem - Create New item
GET /newsItem - Get list of items
GET /newsItem/:id - Get specific item\

Logged user:
GET /users/getMe - Get Logged User Data
PUT /users/changeMyPassword - Update Logged User Password
PUT /users/updateMe - Update Logged User Data\

User addresses:
PUT /addresses - Add user address
DELETE /addresses/:id - Delete user address
GET /addresses - Get user addresses\

Find this project useful ? ❤️

  • Support it by clicking the ⭐ button on the upper right of this page. ✌️

License

   Copyright (C) 2023 M,F,R,B,M Team ❤️