Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🥊 Boxer Registry — REST API

Backend service for managing boxer profiles, users and authentication.

Node.js TypeScript Express MariaDB License


A REST API built with Express and TypeScript on a MariaDB connection pool. It exposes boxer profiles — record, physique, gym, trainer — along with user accounts and a login flow. Companion frontend: Boxer_register (Vue 3).


API

Method Endpoint Description
GET /api/ Service health / index
GET /api/boxers List all boxers
GET /api/boxers/:id Fetch a single boxer
POST /api/boxers Create a boxer
PUT /api/boxers/:id Update a boxer
DELETE /api/boxers/:id Delete a boxer
GET /api/boxers/favorites List favourite boxers
GET /api/users List users
POST /api/users Register a user
POST /api/auth/login Authenticate
POST /api/auth/logout End the session

Boxer model

first_name · last_name · email · height · weight · fight_number · win · losses · kos · gym_number · title · image_link · trainer_name


Architecture

src/
├── server/
│   ├── server.ts        Express app, MariaDB pool, route handlers
│   └── requests.http    Ready-to-run HTTP requests for every endpoint
├── model/
│   ├── boxer.ts         Boxer domain model
│   └── User.ts          User domain model
├── app.ts
└── main.ts
public/                  Bundled frontend build served as static files

Data access goes through a pooled mariadb connection (limit 5). The service also serves the compiled frontend from public/, so the API and the SPA can run from a single process.


Getting started

Requirements: Node.js 18+, MariaDB (or MySQL).

git clone https://github.com/abdessalems/Boxer_BackEnd.git
cd Boxer_BackEnd
npm install

Configure the database via environment variables — the code falls back to local development defaults if they are unset:

DB_HOST=localhost
DB_USER=boxer
DB_PASSWORD=your_password
DB_DATABASE=boxer_db

Run it in watch mode (nodemon + ts-node):

npm start

src/server/requests.http contains a request for every endpoint — open it in VS Code with the REST Client extension to exercise the API without a frontend.


Status

Coursework project (Full-Stack JS). Functional, but with known gaps: no automated test suite is wired up (npm test is a stub), and passwords are stored without hashing — fine for a local exercise, not for deployment.


License

MIT © 2023 Abdessalem Saadaoui

About

REST API for boxer profiles, users and authentication — Express + TypeScript + MariaDB

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages