Skip to content

devpaulius/practica

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Practica

This project provides a REST API for managing events with user authentication, event creation, rating system, and admin control.

Technologies

  • Backend: Node.js, Express, MySQL, JWT authentication
  • Frontend: React, Bootstrap, Axios
  • Database: MySQL

API Endpoints

Authentication

Method Endpoint Description Access
POST /api/register Register new user Public
POST /api/login Login and receive token Public

User Management

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

Event Management

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

Category Management

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

Setup Instructions

Backend

cd backend
npm install
node server.js

Frontend

cd frontend
npm install
npm run dev

The frontend runs at http://localhost:5173 by default. The backend API runs at http://localhost:3001.

Other Information

  • 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

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published