This use case demonstrates how to log errors using DEBUG_MODE. For more information, see the Prefab README.
The project is already configured with the environment variable DEBUG_MODE="true", and also with the specific permissions to the /Log/HTTP.log file. You can force an error, like removing the last line of http-buildable-directories.yml file, then make an HTTP request, you will be able to see that error on the /Logs/HTTP.log file.
- Navigate to the root of UseCase82 on your terminal
- Run
composer install
to install the project dependencies - Run
docker-compose build && docker-compose up -d
to build and start the Nginx, Postgres, Redis, and PHP containers - Run
docker-compose exec prefab_fitness ./bin/database_setup.sh
to create the prefab_fitness database, run migrations, and seed the database with mock data - Run
./vendor/bin/prefab
to run Prefab and generate the Listing HTTP endpoint- Note to Docker For Mac users: This command can be run either inside the container or on the host machine. However, filesystem access using Docker For Mac is often extremely slow. Since Prefab writes a large number of files to disk, running Prefab inside the Docker container can take a significant amount of time. Therefore, it is recommended you run Prefab on the host machine.
Your project is now ready! Notice you now have a fab/
directory with Listing
machinery under fab/MV1
and general HTTP machinery under fab/Prefab5
. You can now query your database over HTTP using
Search Criteria.
This project is configured to listen for requests to port 80 on your docker host. On Mac and Linux the docker host is often localhost
, but you may need to place a specific IP if docker is run on a VM.
Here is an example cURL request to get all listings with an id
less than 20:
curl -g -X GET \
'http://localhost/v1/listing/?searchCriteria[filters][0][glue]=and&searchCriteria[filters][0][field]=id&searchCriteria[filters][0][condition]=lt&searchCriteria[filters][0][values][0]=20'
You can prime the containers before making the first http request.
bin/prime_http_containers.php
You will see the cached container(s) in data/cache.