Event Management API Task is a backend project developed as part of an internship assignment. It provides a RESTful API for managing events, including creation, update, deletion, and retrieval. The project is built with JavaScript and it's run environment and is designed to be simple, scalable, and easy to integrate with frontend or mobile clients.
-
Clone the repository
git clone https://github.com/saurabh7071/Event-Management-API-Task.git cd Event-Management-API-Task -
Install dependencies
npm install
-
Set up environment variables
- Copy
.env.exampleto.envand update values as needed.
- Copy
-
Run the server
npm start # Or for development mode npm run dev
- POST
/events/createEvent - Request Body Example:
{ "title": "Habitant", "event_date": "2025-10-16T05:43:00Z", "location": "New York", "capacity": 2 } - Success Response:
{ "id": "1", "name": "Habitant", "date": "2025-10-16T05:43:00Z", "location": "New York", "capacity": 2, "createdAt": "2025-10-16T06:44:12Z" }
- GET
/events/getEventDetails/<eventId> - Success Response:
{ "statusCode": 200, "data": { "eventid": 3, "title": "Fest", "event_date": "2025-10-16T11:12:00.000Z", "location": "Tokeyo", "capacity": 2, "created_at": "2025-10-16T05:40:54.773Z", "registered_users_count": 2, "registered_users": [ { "userid": 1, "name": "John Doe", "email": "john.doe@example.com" }, { "userid": 2, "name": "Sam", "email": "addfkdja@gmail.com" } ] }, "message": "Event details with registered users retrieved successfully", "success": true }
-
GET
/events/getUpcomingEvents -
Success Response:
{ "statusCode": 200, "data": [ { "eventid": 2, "title": "technokret", "event_date": "2025-11-01T10:00:00.000Z", "location": "xyz", "capacity": 200, "created_at": "2025-10-15T19:27:26.606Z" }, { "eventid": 3, "title": "Habitant", "event_date": "2025-11-01T10:00:00.000Z", "location": "abc", "capacity": 500, "created_at": "2025-10-15T19:32:51.127Z" }, { "eventid": 1, "title": "My Event", "event_date": "2025-11-01T10:00:00.000Z", "location": "New York", "capacity": 200, "created_at": "2025-10-15T17:36:53.594Z" } ], "message": "Upcoming events retrieved successfully", "success": true }
- GET
/events/eventStats/<eventId> - Success Response:
{ "statusCode": 200, "data": { "eventid": 4, "title": "Habitant", "capacity": 2, "totalRegistrations": 2, "remainingCapacity": 0, "percentageUsed": 100 }, "message": "Event statistics retrieved successfully", "success": true }
- POST
/registrations/registerUserForEvent/<eventId> - Request Body Example:
{ "userid": 3 } - Success Response:
{ "statusCode": 201, "data": { "uniqueid": "5759afe9-2aaf-4a7f-b6f1-d300d8d167a8", "registered_at": "2025-10-16T07:38:21.349Z", "userid": 3, "eventid": <eventId> }, "message": "User registered for event successfully", "success": true }
- POST
/registrations/cancelRegistration/<eventId> - Request Body Example:
{ "userid": 3 } - Success Response:
{ "statusCode": 200, "data": null, "message": "User registration successfully cancelled", "success": true }
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
This project is licensed for educational and internship purposes.