This project provides a REST API for managing events with user authentication, event creation, rating system, and admin control.
- Backend: Node.js, Express, MySQL, JWT authentication
- Frontend: React, Bootstrap, Axios
- Database: MySQL
| Method | Endpoint | Description | Access |
|---|---|---|---|
| POST | /api/register |
Register new user | Public |
| POST | /api/login |
Login and receive token | Public |
| Method | Endpoint | Description | Access |
|---|---|---|---|
| GET | /api/me |
Get own user information | Authenticated |
| PUT | /api/me/password |
Change own password | Authenticated |
| GET | /api/admin/users |
Get all users | Admin |
| PUT | /api/admin/users/:id/block |
Block or unblock user | Admin |
| Method | Endpoint | Description | Access |
|---|---|---|---|
| GET | /api/events |
Get approved events | Public |
| GET | /api/myevents |
Get own created events | Authenticated |
| POST | /api/events |
Create new event (awaits approval) | Authenticated |
| PUT | /api/events/:id |
Update own event (or any if admin) | Authenticated |
| DELETE | /api/events/:id |
Delete own event (or any if admin) | Authenticated |
| POST | /api/events/:id/rate |
Rate event (1-5 stars) | Authenticated |
| GET | /api/admin/events |
Get all events | Admin |
| PUT | /api/admin/events/:id/approve |
Approve event | Admin |
| DELETE | /api/admin/events/:id/reject |
Reject and delete event | Admin |
| Method | Endpoint | Description | Access |
|---|---|---|---|
| GET | /api/categories |
Get all categories | Public |
| POST | /api/admin/categories |
Create category | Admin |
| PUT | /api/admin/categories/:id |
Update category | Admin |
| DELETE | /api/admin/categories/:id |
Delete category | Admin |
cd backend
npm install
node server.js
cd frontend
npm install
npm run dev
The frontend runs at http://localhost:5173 by default. The backend API runs at http://localhost:3001.
- All authenticated routes require
Authorization: Bearer <token>header. - Passwords are hashed with bcrypt.
- Default admin account:
Username:admin
Password:123456 - Default user account:
Username:user
Password:123456