Welcome to EventHub’s backend repository! This project provides a RESTful API to support event booking, availability management, and service coordination. It’s designed as a foundation for the backend services of the EventHub platform, ready to integrate with a frontend application.
- Overview
- Features
- Tech Stack
- Installation
- Configuration
- API Endpoints
- Usage
- Frontend Integration
- Troubleshooting
- Contributing
- License
The EventHub backend enables efficient event management, handling all data operations related to events, user accounts, bookings, and availability. Once integrated with a frontend, it will allow users to browse and book events in real-time.
- User Registration & Authentication: Register and authenticate users with JWT.
- Event & Availability Management: CRUD operations for events and service schedules.
- Booking API: Allows clients to book available slots.
- Secure Endpoints: Authentication for sensitive routes.
- Node.js: JavaScript runtime
- Express: Backend framework for creating RESTful APIs
- MongoDB: NoSQL database for storing events, users, and bookings
- JWT: Secure user authentication
Ensure you have:
git clone https://github.com/MariferVL/eventhub-backend.git
cd eventhub-backendnpm installCreate a .env file in the root directory and set up the following:
PORT=5000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
- PORT: Server port (default 5000)
- MONGODB_URI: MongoDB connection string
- JWT_SECRET: Secret for signing JWTs
- POST /api/auth/register: Register a new user
- POST /api/auth/login: User login, returns JWT
- GET /api/users/:id: Fetch user details (protected)
- GET /api/events: Get all events
- POST /api/events: Create a new event (admin only)
- PUT /api/events/:id: Update an event (admin only)
- DELETE /api/events/:id: Delete an event (admin only)
Note: For complete endpoint details, refer to the API documentation file.
Start the backend server:
npm startNavigate to http://localhost:5000/api in your browser or testing tool (like Postman) to explore the API.
This backend is designed to be integrated with any frontend framework. Suggested steps for setting up:
- Configure CORS: Update CORS settings in
app.jsto accept requests from your frontend domain. - Frontend Auth: Send JWT in headers for authenticated requests.
- API Consumption: Make API calls to
http://localhost:5000/api(or deployed domain) to fetch, create, and update data.
- Database Connection Issues: Ensure MongoDB is running and
MONGODB_URIis correct. - JWT Issues: Verify
JWT_SECRETin.env. - CORS Errors: Ensure your frontend domain is whitelisted in CORS settings.
Contributions are welcome! Please follow the standard GitHub flow: fork, make changes, and submit a pull request.
This project is licensed under the MIT License.