Momentum logo
Team 12 Classroom

๐ŸฆŠ Deploying a React Application ๐ŸฆŠ

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

๐Ÿป Views and Serializers in DRF ๐Ÿป

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

๐ŸฆŠ Multiple Components and Conditional Rendering ๐ŸฆŠ

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

๐Ÿป Django REST Framework ๐Ÿป

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