This API allows users to manage a collection of alcoholic beverages. It provides authentication through JSON Web Tokens (JWT) and supports CRUD (Create, Read, Update, Delete) operations for alcohol data and user comments.
Base URL: https://alcool-api.pierrenogaro.com/
To use the API, you need to register and then log in to receive a token for secure access to protected routes.
POST /auth/register
- Register a new user with a username and password.
Headers: Content-Type: application/json
Body: { "username": "yourUsername", "password": "yourPassword" }
POST /auth/login
- Log in with your credentials to receive a token for authentication.
Headers: Content-Type: application/json
Body: { "username": "yourUsername", "password": "yourPassword" }
The following endpoints allow you to manage the alcohol collection. All routes require authentication with a token.
GET /alcools/all
- Retrieve a list of all alcoholic beverages.
GET /alcools/:id
- Retrieve details for a specific beverage by its ID.
Example Request:
GET /alcools/12345
POST /alcools/create
- Add a new alcoholic beverage to the collection.
Headers: Authorization: Bearer <token>
Body: { "name": "AlcoolName", "degree": "45", "ingredients": ["sugar", "water"], "description": "A fine drink" }
PUT /alcools/update/:id
- Update an alcoholic beverage's details by its ID.
Headers: Authorization: Bearer <token>
Body: { "name": "UpdatedName", "degree": "50" }
POST /comments/:alcoolId
- Add a comment to an alcool.
Headers: Authorization: Bearer <token>
Body: { "content": "Great drink!" }
PUT /comments/:id
- Update a comment by its ID.
Headers: Authorization: Bearer <token>
Body: { "content": "Updated content." }
DELETE /comments/:id
- Remove a comment by its ID.
Headers: Authorization: Bearer <token>