A RESTful API for managing events with user authentication, event creation, RSVP functionality, and event deletion. This API is built using Node.js, Express, and MongoDB, and it utilizes JWT for user authentication and Multer for image uploads.
- User Authentication: Users can register and log in to manage their events.
- Create Event: Users can create events with details such as title, description, date, location, max attendees, and an event image.
- View Events: List all upcoming events with filtering options.
- RSVP for Events: Registered users can RSVP for events, with limits based on the max number of attendees.
- Edit/Delete Events: Event creators can edit or delete their events.
- Node.js
- Express.js
- MongoDB (with Mongoose)
- JWT (JSON Web Tokens) for authentication
- Multer for handling file uploads
- Bcrypt.js for password hashing
- dotenv for environment variable management
-
Clone the repository:
git clone https://github.com/DishantMadariya/Event-Management.git cd Event Management
-
Install the dependencies:
npm install
-
Create a
.env
file in the root directory and add your environment variables:MONGO_URI=<your_mongodb_connection_string> JWT_SECRET=<your_jwt_secret_key> PORT=<your_preferred_port_number>
-
Create the
uploads
directory to store uploaded event images:mkdir uploads
-
Start the server:
npm start
-
The API will be running on
http://localhost:<your_preferred_port_number>
.
- POST
/api/auth/register
: Register a new user. - POST
/api/auth/login
: Login a user.
- POST
/api/events
: Create a new event (requires authentication). - GET
/api/events
: Retrieve all upcoming events. - POST
/api/events/:eventId/rsvp
: RSVP for an event (requires authentication). - PUT
/api/events/:eventId
: Edit an event (requires authentication). - DELETE
/api/events/:eventId
: Delete an event (requires authentication).
/event-management-api
├── /controllers # Business logic for handling requests
├── /middlewares # Custom middleware (e.g., auth, file uploads)
├── /models # Mongoose models for MongoDB
├── /routes # API routes
├── /uploads # Directory for storing uploaded images
├── .env # Environment variables
├── package.json # Project metadata and dependencies
└── server.js # Entry point for the application