Skip to content

Latest commit

 

History

History
118 lines (92 loc) · 2.46 KB

File metadata and controls

118 lines (92 loc) · 2.46 KB

Service Review System (Backend)

Live Server URL

🔗 Live Server (Vercel)


Overview

This is the backend of the Service Review System built with Node.js and Express.js, connected to a MongoDB database. It provides a complete RESTful API to handle services, reviews, and user data. The backend includes secure routes, JWT-based authentication, and environment-based configuration for production security.


Key Features

✅ RESTful API for services and reviews ✅ MongoDB with Mongoose for database operations ✅ JWT-based user authorization ✅ Secure protected routes ✅ CORS and environment handling ✅ Fully deployed backend using Vercel


Technologies Used

  • Node.js
  • Express.js
  • MongoDB (with Mongoose)
  • JSON Web Token (JWT)
  • dotenv
  • cors
  • cookie-parser (if used for storing JWT)
  • Vercel (for deployment)

Environment Variables

Create a .env file at the root of the backend project and include:

PORT=3000
MONGODB_URI=mongodb+srv://<username>:<password>@cluster0.mongodb.net/serviceReviewDB
JWT_SECRET=your_jwt_secret_key


**
API Endpoints
✅ Service Routes
Method	Route	Description
GET	/services	Get all services
GET	/services/:id	Get service by ID
POST	/services	Add new service (Protected)
PATCH	/services/:id	Update service (Protected)
DELETE	/services/:id	Delete service (Protected)

✅ Review Routes
Method	Route	Description
GET	/reviews	Get all reviews (optionally by serviceId)
GET	/reviews/:id	Get single review
POST	/reviews	Add review (Protected)
PATCH	/reviews/:id	Update review (Protected)
DELETE	/reviews/:id	Delete review (Protected)

✅ Auth Routes
Method	Route	Description
POST	/jwt	Get JWT token

Deployment
The backend is deployed to Vercel. Make sure your vercel.json includes:

json
Copy code
{
  "version": 2,
  "builds": [
    {
      "src": "index.js",
      "use": "@vercel/node"
    }
  ],
  "routes": [
    {
      "src": "/(.*)",
      "dest": "index.js"
    }
  ]
}
How to Run Locally
Clone the Repository:

bash
Copy code
git clone https://github.com/Programming-Hero-Web-Course4/b11a11-server-side-developerTamanna
cd service-review-backend
Install Dependencies:

bash
Copy code
npm install
Create .env file and configure it as mentioned.

Run the server:

bash
Copy code
node index.js
Or use nodemon for auto-restart:

bash
Copy code
npx nodemon index.js
Author
Developed by Tamanna Akter
📧 Email: astamanna57@gmail.com
🌍 GitHub: developertamanna