For roughly as long as I've been teaching, I've been using doughnuts in every example I possibly could. They're delicious, obviously nutritious, and a great go-to.
In order to really make the most of this example, and for the secondary goal of teaching RESTful APIs & AJAX, here's a super-simple, in-memory RESTful Doughnut API.
It's built on the unbelievably simple & beautiful https://github.com/typicode/json-server, and there's some basic doughnut seed data.
You can:
- GET
- POST
- PUT
- PATCH
- DELETE
It's stored in memory and hosted on Heroku, which means that it'll act like it persists in a response, without actually changing anything. So if you POST a new doughnut, it'll respond with details of that doughnut as if it succeeded, but if you do a GET request on the index, it won't be there. Which is actually pretty great when we've got a handful of students working off the same endpoints.
Try it! https://www.doughnuts.ga