The Fruit App is a web application consisting of a Symfony backend API and a Vue.js frontend. The backend API provides endpoints for managing fruits, while the frontend allows users to view and interact with the fruits.
Before you begin, ensure that you have the following installed:
-
Clone the source repository:
git clone https://github.com/faisal-ibrahim/symfony-vue-fruit-app.git
-
Navigate to the project directory:
cd symfony-vue-fruit-app
-
Build and run the Docker containers:
docker-compose up --build -d
-
Wait for the complete setup. You can check the status of whether all the containers are up and running via the following command:
docker ps
To fetch fruits and insert them into the database, run the following commands:
-
Enter the PHP container:
docker exec -it php-server /bin/bash
-
Inside the container, run the following command:
bin/console app:fetch-fruits
The backend API will be running at the following URL: http://localhost:8081
Method | Endpoint | Param | Comment |
---|---|---|---|
GET | api/fruits |
page, limit, name, family | List of fruit, filterable via name and family |
GET | api/favorites |
List of favorite fruits | |
POST | api/favorites/{id} |
fruit id as path param | Add fruit as favorite |
DELETE | api/favorites/{id} |
fruit id as path param | Remove fruit from favorite |
The frontend application will be running at the following URL: http://localhost:5173
Before running the tests, ensure that you have completed the setup environment steps above.
- Setup the test Database (only first time)
docker exec -it php-server /bin/bash bin/console --env=test doctrine:database:create bin/console --env=test doctrine:schema:create bin/console --env=test doctrine:fixtures:load
- Run the tests using PHPUnit:
./vendor/bin/phpunit