Author: James Wedam Anewenah
Templates: Symfony Docker
-
If not already done, install Docker Compose (v2.10+)
-
Run
docker compose build --no-cache
to build fresh images -
Run
SYMFONY_VERSION=6.1.* docker compose up --pull always -d --wait
to start the project -
Run
docker exec -d replace-with-container-name bin/console doctrine:schema:create
to migrate the database. Remember to replace the actual container name. -
Open
https://localhost
in Chrome and accept the auto-generated TLS certificate. -
Interact with the API using an appropriate browser-based GraphQL client like GraphiQL.
-
The API endpoint is
https://localhost/graphql.json
-
Authentication is done using tokens. The response after signing up/signing in contains an
X-Auth-Token
header with the authentication token. You can view the response header by accessing chrome's dev-tools. Pass the token header with subsequent requests to authenticate them. The image below demonstrates how to do this with the aforementioned GraphiQL client. -
Run
docker compose down --remove-orphans
to stop the Docker containers. -
It is recommended to install Docker Desktop for easy viewing/management of containers.
- Limit - Integer from 1 to 100
- Page - Integer greater than or equal to 1
- EmailAddress - Email address
- Name - String consisting of only chars or spaces
- Password - String of length greater than or equal to 8
- Price - Decimal String with two-point precision in range 0.00 - 1000000000.00
- ProductName - String consisting of only chars, digits, or spaces
- Role - Either ROLE_USER or ROLE_ADMIN
- Stock - Integer greater than or equal to 0 but less than 1000000