Node.js Express PostgreSQL JWT Jest · 27 tests

BookLoop

API REST de location de livres en ligne. Authentification JWT, transactions SQL atomiques, 27 tests automatisés, déployée en production sur Render.

▶ Swagger UI ⌥ Code source
Vérification de l'API…

Stack

Technologies utilisées

Runtime
Node.js v24+
ES Modules
Framework
Express.js
REST API
Base de données
PostgreSQL
Transactions SQL
BEGIN/COMMIT/ROLLBACK
Auth & Sécurité
JWT (jsonwebtoken)
bcrypt (hachage)
Validation
Zod
Middleware dédié
Tests
Jest + Supertest
27 tests passés
Documentation
Swagger UI
swagger-jsdoc
OpenAPI 3.0
Déploiement
Render (Web Service)
PostgreSQL managé
CI/CD auto push

API

Endpoints

🔓 Public  ·  🔒 Requiert Authorization: Bearer <token>

Authentification
POST/auth/registerCréer un compte🔓
POST/auth/loginConnexion → token JWT🔓
Membres
GET/membresTous les membres🔒
GET/membres/:idUn membre par id🔒
POST/membresInscrire un membre🔒
PUT/membres/:idModifier un membre🔒
DELETE/membres/:idSupprimer un membre🔒
Livres
GET/livresTous les livres🔒
GET/livres/disponiblesLivres disponibles à la location🔒
GET/livres/:idUn livre par id🔒
POST/livresAjouter un livre🔒
PUT/livres/:idModifier un livre🔒
DELETE/livres/:idSupprimer un livre🔒
Locations
GET/locationsToutes (JOIN membres + livres)🔒
GET/locations/:idUne location par id🔒
POST/locationsCréer une location (livre → indisponible)🔒
PATCH/locations/:id/retourRetourner un livre (livre → disponible)🔒
DELETE/locations/:idSupprimer une location🔒

Documentation interactive complète → Swagger UI


Tests

Suite automatisée - 27 tests

auth.test.js
7
tests passés
membres.test.js
10
tests passés
livres.test.js
7
tests passés
locations.test.js
3
tests passés

Total : 27 / 27 - Jest + Supertest sur base dédiée bookloop_test