This API is designed to manage and administer meal menus, provided to create, read, update and delete meal records from a MySQL database.
- Meal CRUD: Implementation of API endpoints to create, read, update and delete meal records.
- CORS Security: Configuration of CORS headers to allow access from any source.
- Request Handling: Implementation of logic to handle different types of HTTP requests (GET, POST, PUT, DELETE).
- MySQL Database: Use of a MySQL database to store and manage meal data.
- PHP
- MySQL
- JavaScript (for integration with the frontend, if applicable)
- Git
- PHP 7.0 o superior
- Servidor web compatible (Apache, Nginx, etc.)
- MySQL server
- Clone this repository:
git clone https://github.com/KevinJp21/API-Food.git
- Configure the database: Import the database creation script (
Foods.sql
) into your MySQL server. - Add your environment variables
DB_HOST=host
DB_USER=user
DB_PASSWORD=password
DB_DATABASE=Database name
- Configure the
config.php
file: Make sure to correctly configure the connection credentials to your MySQL database. - Start your web server and verify that the project is correctly configured.
- API Endpoints:
GET /getFood.php
: Obtain all available foods.GET /getFood.php?id=id
: Get a specific food by its ID.POST /saveFood.php
: Saves a new food.PUT /updateFood.php
: Upgrade an existing food.DELETE /deleteFood.php?id=id
: Delete a specific food by its ID.