Backend API for the Nutrigo App, providing endpoints for nutrition education.
To get started with the API, follow these steps:
- Clone the repository:
git clone https://github.com/your-username/nutrigo-api.git - Install dependencies:
npm install - Start the server:
npm start - Use a tool like Postman or cURL to test the API endpoints
- POST /api/v1/register: Register a new user
- Request Body:
name: string (required)email: string (required, must be a valid email address)password: string (required, minimum 6 characters)
- Response: JSON object with user data and JWT token
- Request Body:
- POST /api/v1/login: Login an existing user
- Request Body:
email: string (required, must be a valid email address)password: string (required)
- Response: JSON object with user data and JWT token
- Request Body:
- POST /api/v1/products: Create a new product
- Request Body:
barcode: string (required)name: string (required)nutrition: object (required)energy: numbertotal_fat: numbersaturated_fat: numbercarbohydrate: numbersugar: numbersodium: numberprotein: number
- Response: JSON object with product data
- Request Body:
- GET /api/v1/products: Get all products
- Response: JSON array of product data
- GET /api/v1/products/{barcode}: Get a product by barcode
- Path Parameters:
barcode: string (required)
- Response: JSON object with product data
- Path Parameters:
- PUT /api/v1/products/{barcode}: Update a product
- Path Parameters:
barcode: string (required)
- Request Body:
name: stringnutrition: objectenergy: numbertotal_fat: numbersaturated_fat: numbercarbohydrate: numbersugar: numbersodium: numberprotein: number
- Response: JSON object with updated product data
- Path Parameters:
This project is licensed under the CC0 1.0 Universal License. See LICENSE for more information.