For the test I created a project containing Laravel 10.
I have used Laravel Sail to set up an environment via docker. It will run PHP 8.2
and MySQL 8.0
.
The configuration I have applied, is defined in the ./.env.example
file.
If you want you can rename it to .env
and use it or you can adapt it according to your needs.
cp .env.example .env
The chosen ports, has been because I currently have other applications in my local, and I had to avoid duplicity for its correct operation.
# Ports configured
APP_PORT=86
VITE_PORT=5175
DB_PORT=3308
Note: Don't forget to set your db settings and ports if they are not correct.
composer install
To get the container up we can launch the following command:
./vendor/bin/sail up
./vendor/bin/sail stop
./vendor/bin/sail artisan key:generate
./vendor/bin/sail artisan migrate
./vendor/bin/sail artisan db:seed
./vendor/bin/sail test
./vendor/bin/sail test --testdox
I have created a collection with the requests to be able to test the API. It can be imported and used directly.
Download: ./storage/postman/iAhorro_codeChallenge.postman_collection.json
This configuration has created as variables what is necessary to mount the URL in each of the EndPoints. So you should check if you have changed the port that was preconfigured in the environment file.
"variable": [
{
"key": "HOST",
"value": "http://localhost:86/",
"type": "string"
},
{
"key": "PATH_API",
"value": "api/",
"type": "string"
},
{
"key": "ENTITY_LEAD",
"value": "leads",
"type": "string"
}
]