gem install docker-sync to install it)Application configuration is stored in .env file.
If you have nginx or apache installed and using 80 port on host system you can either stop them before proceeding or
reconfigure Docker to use another port by changing value of SERVER_HTTP_PORT in .env file.
You can change application environment to dev of prod by changing APP_ENV variable in .env file.
Redis credentials could by reconfigured by changing variable REDIS_URL. It is
recommended to restart containers after changing these values.
On Linux:
docker-compose -f docker-compose-dev.yml up -d
On MacOS:
docker-sync-stack start
Just go to http://localhost
The app stores each message in redis. Message has the following fields:
POST request.secondsLimits seconds the message will be permanently destroyed.Base URL for the API is yourdomain.org/api. All endpoints have prefix /api.
If any error appears the response body would automatically get an element with key errors. This element has an array with the keys equal to the fields that have caused the error. Each field is also an array of string variables representing errors in text format.
Please note that in case of the error the status code is changed to 400 (for POST /messages request) or to 404 (GET /messages/{id})
{
"errors":
{
"secondsLimit":
[
"This value should not be blank.",
"This value should not be greater than 5"
],
"requestsLimit":
[
"This value should not be blank."
]
}
}
The request is used to create new message.
Important: the data should be sent with POST request with raw data in json format. An example of the raw request body is the following:
{
"message":"text",
"secondsLimit":10,
"requestsLimit":5
}
{
"id":"745e8728047f7c7970d13d47b2ffb737faa3c9b7",
"message":"text",
"expires":"2018-05-12T21:21:48+00:00",
"requestsLimit":2,
"secondsLimit":100
}
The request is used to get the message with given id.
No
{
"id":"745e8728047f7c7970d13d47b2ffb737faa3c9b7",
"message":"text",
"expires":"2018-05-12T21:21:48+00:00",
"requestsLimit":2,
"secondsLimit":100
}
If a message is not found the response has the status code 404 and the following error appears:
{
"errors":
{
"id":"Message not found"
}
}
The request can be used to provide the actual status of the API (test request).
No
{
"status":"OK"
}
requestsLimit variable won't be changed in the response due to the security reasons (in other words: a user should not know how many tries are left).GET /messages/{id} decreases by 1 the number of attempts. When it is equal to zero the message will be destroyed.Fix code style by running PHP CS Fixer:
docker-compose exec php vendor/bin/php-cs-fixer fix
docker-compose exec php bin/phpunit
Content type
Image
Digest
Size
106.1 MB
Last updated
about 8 years ago
docker pull 4xxi/caesarapp-server