https://github.com/eduardapontel/support-tickets
A lightweight Node.js REST API for managing customer support tickets. Built using only native modules and custom utilities, this project allows full CRUD operations for support tickets, stored locally in a JSON file.
https://github.com/eduardapontel/support-tickets
api-rest crud json node-js
Last synced: 2 months ago
JSON representation
A lightweight Node.js REST API for managing customer support tickets. Built using only native modules and custom utilities, this project allows full CRUD operations for support tickets, stored locally in a JSON file.
- Host: GitHub
- URL: https://github.com/eduardapontel/support-tickets
- Owner: eduardapontel
- Created: 2025-06-07T00:12:05.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-06T00:17:38.000Z (12 months ago)
- Last Synced: 2025-10-25T04:11:00.812Z (8 months ago)
- Topics: api-rest, crud, json, node-js
- Language: JavaScript
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Support Tickets 🛠️
A lightweight Node.js REST API for managing customer support tickets. Built using only native modules and custom utilities, this project allows full CRUD operations for support tickets, stored locally in a JSON file.
## ✨ Features
- Create new support tickets
- List all existing tickets
- Update ticket information and status
- Delete tickets
- Middleware for JSON body parsing and route handling
- No external frameworks – built with Node.js core modules
## 📁 Project Structure
- `support-tickets/`
- `package.json`: Contains metadata about the project, such as name, version, and dependencies.
- `src/`: Contains the main source code of the application.
- **`server.js`**: Entry point of the server. It initializes the server, applies middlewares, and loads routes.
- **`controllers/`**: Holds the logic for handling ticket operations.
- **`tickets/`**
- `create.js`: Handles the creation of new support tickets.
- `index.js`: Retrieves and lists all support tickets.
- `remove.js`: Deletes a specific support ticket.
- `update.js`: Updates ticket data like title and description.
- `updateStatus.js`: Changes the status of an existing ticket.
- **`database/`**: Responsible for data persistence.
- `database.js`: Provides helper functions to read/write data from/to the JSON database.
- `db.json`: The actual database file storing all tickets in JSON format.
- **`middlewares/`**: Custom middleware functions used by the server.
- `jsonHandler.js`: Parses incoming requests with JSON payloads.
- `routeHandler.js`: Handles custom routing logic for incoming HTTP requests.
- **`routes/`**: Defines the API routes.
- `index.js`: Exports all route configurations to be used in the server.
- `tickets.js`: Defines routes related to ticket operations (GET, POST, PUT, DELETE).
- **`utils/`**: Utility/helper functions.
- `extractQueryParams.js`: Parses query parameters from URLs.
- `parseRoutePath.js`: Matches and parses dynamic route paths (e.g., `/tickets/:id`).
## 🚀 Getting Started
1. Clone the repository
```bash
git clone https://github.com/eduardapontel/support-tickets.git
```
2. Install dependencies
```bash
npm install
```
3. Run the server
```bash
node src/server.js
```
The API will be running at ```http://localhost:3333```.
## 🔗 API Endpoints
| Method | Endpoint | Description |
| ------ | --------------------- | -------------------- |
| GET | `/tickets` | List all tickets |
| POST | `/tickets` | Create a new ticket |
| PUT | `/tickets/:id` | Update ticket data |
| PATCH | `/tickets/:id/status` | Update ticket status |
| DELETE | `/tickets/:id` | Delete a ticket |
All data is stored persistently in src/database/db.json.
## 🤝 Contributing
Feel free to contribute to this project by submitting issues or pull requests. Your feedback and suggestions are always welcome!