avatar Bite 339. Retrieve food objects

Now that our API can add food objects, let's retrieve them from the foods dictionary.

In this Bite you will write two endpoints to do so:

- read_foods() to retrieve all foods

- read_food() to retrieve a single food by id (i.e. the key in the foods dictionary). For this you will need what FastAPI calls a path parameter.

After completing this Bite, you will be halfway there with the CRUD (create-read-update-delete) of foods. In the next Bite we'll have you implement the update and delete endpoints.

Good luck!

Login and get coding
go back Intermediate level
Bitecoin 3X

139 out of 146 users completed this Bite.
Will you be Pythonista #140 to crack this Bite?
Resolution time: ~28 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 5.0 on a 1-10 difficulty scale.
» Up for a challenge? 💪

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help