Posted on May 26th, 2022
๐๏ธ Todayโs topics
- React Trivia progress
- Organizing your code
- Deploying to Netlify
๐ฏ Project
The React Trivia application is due on Monday. It should meet at least the minimum functional requirements and is deployed to Netlify. ๐
Minimum functional requirements:
- A user can see a list of categories.
- A user can select one category.
- A user can see questions for that category, with answer options for each question.
- A user can select an answer for a question.
- A user can see if that answer is the correct answer.
It would be awesome if:
- The answers are shuffled so that the correct answer is not always in the same position.
- The questions are shown one at a time instead of all at once, and the user is able to advance through the set of questions.
- A user can see how many questions they answered correctly (or some kind of score) when they have answered all the questions in a category.
๐ Read | ๐บ Watch | ๐ง Listen
๐ Resources
๐พ Code
Posted on May 26th, 2022
๐๏ธ Todayโs Topics
- Views and viewsets
- Nesting and customizing serializers
- Permissions
๐ฏ Project
Keep on with your API building ๐ ๐ช! What do you need to know to get it working?
By now you should have a list of endpoints that your API offers, even if they are not all complete yet. A good place for this would be in your README, formatted with Markdown. This list should show the URLs along with the HTTP methods/verbs, and ideally should include an example of the JSON that has to be included in the request body (for any requests that send data in the body) and an example of the JSON response that will be returned, for each endpoint. This list will be helpful for your own testing and it can serve as necessary documentation for your API.
Here is an example of what your documentation might look like for an endpoint to create a book:
Create a new book
request
Requires authentication.
title
and author
are required fields.
POST api/books
{
"title": "The Anatomy of Melancholy",
"author": "Robert Burton",
"publication_year": 1621
}
response
201 Created
{
"pk": 6,
"title": "The Anatomy of Melancholy",
"author": "Robert Burton",
"publication_year": 1621,
"featured": false,
"reviews": []
}
By today or tomorrow, your app should respond with json to GET requests for all habits/books, for one habit/book, and for one book/habitโs associated objects (daily records for habits; reviews or trackers for books). By tomorrow you should also have at least some of your POSTs working, and can begin working on updates and deletes.
๐ Make sure you test your endpoints in Insomnia to confirm that they are working as intended.
Is your app deployed to Heroku yet? ๐ ๐
๐ Resources
Serializers
Permissions
๐พ Code
Posted on May 24th, 2022
๐๏ธ Todayโs Topics
- Troubleshooting AJAX requests and getting data on the page
- Using multiple components and conditional rendering to create multiple views of your application
๐ฏ Project
Continue React Trivia. Remember to take it step by step! Donโt try to do too much at once.
For Thursday, make your trivia categories selectable. When selected, you should show at least 10 questions for that category.
If you can get that working, the next step is to show a single question with answer choices. After that you can make the answer choices selectable.
๐ Resources
CS resources we talked about in class, relevant to ๐ณ๐ณ๐ณ๐ณ
๐ฆ Code & Notes
Posted on May 24th, 2022
๐๏ธ Todayโs Topics
Today we dive into Django REST Framework. ๐คฟ
๐ฏ Project: Choose Your Own Adventure ๐ช ๐ซ
Choose one of the following options.
The application must be deployed to Heroku, whichever option you choose. ๐
๐ช OPTION ONE: Add an API to Habit Tracker
Add a new app to your existing Habit Tracker project and call it api
. Your app should provide CRUD endpoints that return JSON responses.
By Friday afternoon, you should be able to do the following via the API โ that is, by making requests using Insomnia.
- list habits
- create a new habit
- view a habit
- update a habit
- delete a habit
By Monday, you should be able to complete all CRUD tasks through the API:
- list habits
- create a new habit
- view a habit
- update a habit
- delete a habit
- list records for a habit (this should be on the habit detail API endpoint)
- create a record for a habit for today (stretch: create a record for any date)
- update a record for a habit
- delete a record from a habit
Write up a list of endpoints you think you will need before you start doing this!
You should develop and test your endpoints using Insomnia. (You can also use the browsable API that DRF gives you in the browser, but you should be comfortable using Insomnia.)
๐ซ OPTION TWO: Django Library API
Link to assignment invitation.
Create a new API-only application that lets users keep track of books they are reading, want to read, or have read, and take private or public notes on books.
You should not make forms or templates for this app, but you will need models, urls, views, and serializers. You should use class-based views and return JSON responses.
๐ Read | ๐บ Watch | ๐ง Listen
๐ Resources
Blog articles that go with Lacey Williams Henschelโs talk
๐ฆ Code