The Event Management API is a RESTful service designed to facilitate the creation and storage of event-related data, including multiple image uploads. Built with Node.js and MongoDB, this API allows users to send event details through a POST request and efficiently manage the storage of event information and associated images. The API is tailored to meet the needs of event organizers, providing a streamlined process for submitting and storing event data.
- Event Data Storage: Allows users to send event details such as name, title, description, location and date through a POST request.
- Multiple Image Uploads: Supports the upload of multiple images associated with an event. Images are stored locally with a unique timestamped filename.
- Multer Integration: Utilizes the Multer middleware for handling multipart/form-data, which is essential for uploading images.
- MongoDB Integration: Stores event data in a MongoDB database, ensuring efficient and reliable data management.
- API Endpoint: Provides a dedicated endpoint (
http://localhost:8032/api/events
) for submitting event data and images. - Success Response: Sends a success message upon successful data storage and image upload, confirming the creation of the event.
- Node.js: Provides a fast and scalable runtime environment for building server-side applications.
- Express.js: A minimalist web framework for Node.js, used to build the API endpoints.
- MongoDB: A NoSQL database used for storing event data.
- Multer: A middleware for handling multipart/form-data, used for image uploads.
- Description: Creates a new event and stores event details in the MongoDB database. Uploads multiple images and stores them locally.
- Payload:
eventName
(string): The name of the event.eventTitle
(string): The title of the event.eventDescription
(string): A brief description of the event.eventLocation
(string): The location where the event will take place.eventDate
(date): The date of the event.images
(array): An array of images to be uploaded.
- Response: Success message upon successful creation of the event and image upload.
- Node.js
- MongoDB
-
Clone the Repository:
git clone https://github.com/AxatSachani/Event-Management cd event-management
-
Install Dependencies:
npm install
-
Create .env File:
PORT=8032 MONGO_URI=mongodb://localhost:27017/event_management
-
Run the Server:
npm start
-
Using the API:
- Use Postman or any other API client to send a POST request to
http://localhost:8032/api/events
with the required payload and images. - Example payload:
{ "eventName": "Annual Meetup", "eventTitle": "Tech Conference 2024", "eventDescription": "A conference for tech enthusiasts", "eventLocation": "San Francisco, CA", "eventDate": "2024-09-12", "images": [/* array of images */] }
- Use Postman or any other API client to send a POST request to