This project is an Event Management API built in Node.js that allows users to create, view, update, and delete events. Additionally, users can register for events, and the API sends a confirmation email upon successful registration.
Goal: Build a simple event management API with the following features:
- Event Creation: Users can create new events.
- Event Retrieval: Users can view a list of events or details of a specific event.
- Event Update: Users can update existing events.
- Event Deletion: Users can delete events.
- User Registration: Users can register for an event and receive a confirmation email.
-
POST /events: Create a new event.
- Fields:
name
,description
,date
,location
.
- Fields:
-
GET /events: Retrieve a list of events with pagination support.
-
GET /events/:id: Retrieve event details by ID.
-
PUT /events/:id: Update event details by ID.
-
DELETE /events/:id: Delete an event by ID.
-
POST /events/:id/register: Register a user for the event.
- Fields:
name
,email
.
- Fields:
- Use MongoDB to store event data and user registrations.
- Validate incoming data using Joi.
- Ensure the event's date is not in the past during creation or updating.
- Implement proper error handling for:
- Invalid data.
- Non-existent event IDs.
- Failed email delivery.
- Pagination: Add pagination for listing events.
- File Upload: Implement file upload functionality for event banners or images.
- Node.js (v22.1.0 or higher)
- MongoDB (Local or Atlas)
- Nodemailer (for email functionality)
- Ethereal test account
-
Clone the Repository
git clone https://github.com/your-username/Digitalcube-Task-Event-Management-API.git cd Digitalcube-Task-Event-Management-API
-
Install Dependencies
npm install
-
Set Up Environment Variables
-
Create a .env file in the root directory and add the following:
MONGO_URI=your_mongodb_connection_string PORT=5000 ETHEREAL_USER=your_ethereal_user ETHEREAL_PASS=your_ethereal_password
-
Running the Server
npm run start
The server will run on http://localhost:5000.