We want to build a pizza from a list of ingredients. The Pizza will have a name, a description, and toppings.
Please build a client that will meet the following acceptance criteria:
- As a pizza client user, I should be able to list existing pizzas.
- As a pizza client user, I should be able to create a new pizza.
- As a pizza client user, I should be able to create toppings that can be added to a pizza.
- As a pizza client user, I should be able to list the toppings I can to add to a pizza.
- As a pizza client user, I should be able to add a topping to a pizza.
- As a pizza client user, I should be able to list toppings on a pizza.
Additionally:
- All coding must be done using TDD following The Three Rules of TDD.
- Code can be written using the language and environment you feel will best represent yourself to the reviewers.
For development and testing, you can run Docker containers for the database and the web services.
To get Docker for your development environment, start here https://www.docker.com/community-edition. If you are installing docker in an environment other than Mac or Windows, be sure you also install Docker Compose.
With Docker ready to go, you can now clone this project.
Launch a terminal session and run the following within the cloned projects root:
docker-compose up
This starts the database and web service containers. Once they are ready, you will need the IP address of the Docker machine. Get that by running:
docker-compose ps
Look for the pizzaserver_web line:
pizzaserver_web_1 /bin/sh -c ./bootstrap.sh Up 0.0.0.0:3000->3000/tcp
In the example above and the examples below the ip address is 0.0.0.0
. Be sure to replace them with the ip address your docker container is actually using.
Use these resources to build your client.
GET toppings # List toppings
POST toppings # Create a topping
GET pizzas # List pizzas
POST pizzas # Create a pizza
GET pizzas/:id/toppings # List toppings associated with a pizza
POST pizzas/:id/toppings # Add a topping to an existing pizza
Example curl command to get the toppings:
curl http://0.0.0.0:3000/toppings
Example curl command to create a pizza:
curl -H "Content-Type: application/json" -H "Accept: application/json" http://0.0.0.0:3000/pizzas --data '{"pizza": {"name": "belleboche", "description": "Pepperoni, Sausage, Mushroom"}}'
A Pizza is a baked, round piece of dough covered with sauce and toppings
POST /pizzas, {"pizza" => {"name" => "Belleboche", "description" => "Pepperoni, Mushroom and Sausage"}}
GET /pizzas
Raw ingredients that can be added to a pizza
POST /toppings, {topping: {name: "Pepperoni"}}
GET /toppings
Pizza Toppings are Toppings that have been added to a Pizza
POST /pizzas/:pizza_id/toppings, {topping_id: 1}
GET /pizzas/:pizza_id/toppings