This repository hosts the backend code for the Customer Support Request System. It provides RESTful APIs for user authentication, ticket management, comments .
The backend is crafted using Node.js, Express.js, and MongoDB as the database. It adheres to a modular structure with controllers, services, and models for each entity.
Swagger powers the API documentation for the backend. To explore the documentation, fire up the server and navigate to:
http://localhost:8000/api-docs
Swagger offers a user-friendly interface for visualizing and interacting with the API, offering details about each endpoint, request bodies, response schemas, and more.
Here are the primary endpoints provided by the backend API:
- Authentication:
POST /api/auth/signup: Register a new user. POST /api/auth/login: Log in an existing user. POST /api/auth/forgot-password: Request a password reset email. POST /api/auth/reset-password: Reset the user's password.
- Tickets:
POST /api/tickets: Create a new ticket. GET /api/tickets: Retrieve all tickets. GET /api/tickets/:id: Retrieve a specific ticket. GET /api/tickets/comment/:id: Retrieve comments for a specific ticket. GET /api/tickets/closed: Retrieve tickets closed within a date range. PATCH /api/tickets/:id: Update a ticket. DELETE /api/tickets/:id: Delete a ticket.
- Comments:
POST /api/comments: Add a new comment to a ticket. GET /api/comments: Retrieve all comments. GET /api/comments/:id: Retrieve a specific comment. PATCH /api/comments/:id: Update a comment. DELETE /api/comments/:id: Delete a comment.
Setup Guide To run the backend, follow these steps:
-
Clone this repository to your local machine.
-
Install dependencies:
npm install
-
Configure the MongoDB connection string in the .env file.
-
Build the TypeScript code:
npm run build
- Start the server:
npm start
- Access the API documentation at http://localhost:8000/api-docs.
- Start the server:
npm start
- Run the development server (with nodemon):
npm run dev
- Build the project
npm run build
- Run tests
npm test