Test in order to integrate BuyCo
- docker et docker-compose Installation help
- firsty, build the app with the command:
docker-compose build
- secondly, run the app with the command:
docker-compose up
In order to communicate with the application, you must be able to do some post request at any endpoint of the application.
Some applications that do the job:
- Postman (Chrome browser )
- RESTClient (Firefox browser )
- AdvancedRestClient (Linux Application)
You can also use 'curl', an unix package that can do request.
The application will run locally on localhost:8000
In order to communicate with the application, your request will need to follow the requirements given below:
Only 'application/json' post request are accepted.
So your request will need to have:
Header-name: Content-type -> Header value: application/json
Only json datas are accepted, with the following set of 'data' => 'value' :
{
"id": number,
"type": (cardboard|wood|metal),
"locked": boolean,
"height": number,
"width": number,
"depth": number,
"contents": string,
"origin": {
"line1": string,
"line2": string,
"city": string,
"state": string,
"postal_code": string,
"country": ISO_3166_alpha3
}
}
exemple with curl:
curl -d '{"id": 2, "type": "metal", "locked": true, "height": 1, "width": 1, "depth":2.25, "contents":"some fishs", "origin": {"line1": "27 rue du general foy", "line2": "place de la republique", "city": "Saint Etienne", "state": "france", "postal_code": "42000", "country": "fra"}}' -H "Content-Type: application/json" -X POST http://localhost:8000
connecting to the database:
docker-compose exec database psql -U admin
reseting database:
docker-compose down
docker volume rm buycotest_database-data
docker-compose up