تفاصيل العمل

🛒 E-Commerce API

A RESTful API for an E-Commerce system built using Node.js and Express. The API supports user authentication, product management, and more.

🚀 Features

User Authentication (Register & Login)

JWT Authorization

Role-Based Access Control

Product Management (CRUD)

Image Upload Support

Secure API with middleware (Helmet, CORS)

🛠️ Tech Stack

Node.js

Express.js

MongoDB

Mongoose

JWT (Authentication)

📦 Installation

Clone the repository:

git clone https://github.com/saraha...

cd E-commerce-api

Install dependencies:

npm install

Create .env file:

PORT=8000

MONGODB_URI=your_database_url

JWT_SECRET=your_secret_key

Run the server:

npm run dev

🔐 Authentication Endpoints

Register User

POST /api/auth/register

Login User

POST /api/auth/login

📦 Product Endpoints

Get All Products

GET /api/products

Get Single Product

GET /api/products/:id

Create Product (Admin)

POST /api/products

Update Product (Admin)

PUT /api/products/:id

Delete Product (Admin)

DELETE /api/products/:id

🧪 Testing

You can test the API using:

Postman

Thunder Client

📁 Project Structure

├── controllers

├── models

├── routes

├── middlewares

├── config

├── uploads

├── .env

├── app.js

⚠️ Notes

Make sure .env is not pushed to GitHub

node_modules should be ignored using .gitignore

👩‍💻 Author

Sarah Abdelsamie

⭐ Support

If you like this project, give it a ⭐ on GitHub!

ملفات مرفقة

بطاقة العمل

اسم المستقل
عدد الإعجابات
0
تاريخ الإضافة
تاريخ الإنجاز
المهارات