Momentum logo
Team 14 Classroom

🐻 Designing Your Models & Your API 🐻

Posted on Sep 20th, 2022

🗓️ Today’s Topics

  • Models for your collaborative project
  • Designing the URLs you need
  • CORS

🎯 Project

Today you should have your models nailed down and be able to work with them in the admin and the shell – that is, you can save them to the database and retrieve them, and all the relationships work properly.

You should have a plan written down for at least the basic set of urls that your front-end will need. You may make changes to this as you go, but you need a place to begin.

When creating your list of endpoints, remember to only build what you need.

  • What lists or collections of data will you need to return? (There are probably some you can omit.)
  • What single resources will you need to provide?
  • What HTTP methods will you need to support for each endpoint? (There are probably some you don’t need.)
  • Which routes will need the user to be authenticated and which do not require authentication?
  • Will you need to restrict any actions at the object level? For example, you’ll probably want to make sure that only the owner of a resource can make changes to it, or add associated objects.

By Friday

Your API should…

  • return JSON for GET requests for questions and answers OR cards and friends
  • accept POST requests to create questions and answers OR cards and friends

🔖 Resources

Permissions

CORS

⭐ TMI Databases: Deeper Dive into the Theory Behind the Best Practices

This is very much optional right now but important to learn about at some point if you’re going to be working with data in your job.

👾 Code & Notes

🐻 💞 🦊 Phase 3 Collaborative Project 🦊 💞 🐻

Posted on Sep 19th, 2022

🎯 Collaborative Project

This week you will begin work on a project with both front- and back-end teammates. This project is due next week at the end of the Phase.

The front-end will build a React application that will make AJAX requests to the back-end application built with Django and Django REST Framework. There are no strict rules about who works on front-end or back-end, so your team can decide how best to use your resources.

Your team can choose between two projects. They will both give you practice doing what you have been doing (building an API or building a React application based around CRUD functionality) but they present some different problems to solve.

Choose the one that sounds more fun or interesting to you.

Options

Social ECards

QuestionBox

Whichever one you choose, your whole team is building the same one.

How to accept the assignment and create the repos on GitHub

The back end will work in their own repo and the front end will work in their own repo, so for the same project each team will have two repos.

One back-end dev should accept the assignment invitation and name the team something like “Team Yeti Back-end” (whatever your team name is!). Then the other back-end dev(s) should accept the assignment and choose the right team. All back-end folks on the team clone that same repo.

One front-end dev should accept the assignment invitation and name the team something like “Team Yeti Front-end” (whatever your team name is!). Then the other front-end dev(s) should accept the assignment and choose the right team. All front-end folks on the team clone that same repo.

If you are the only dev in your repo, you may choose not to use pull requests, although you can, and it is still a good idea to use branches. If you have two backend devs on your team, you must use pull requests.

When you start work in this repo, you should delete the README at the root so it doesn’t conflict with the files you will create for the project. You can save it somewhere else – it’s just a Markdown file. When you start your Django or React app, you should install it at the root of the repo directory, not in a subdirectory (you do this by specifying the current directory with a . instead of a project name). This will make deploying easier.

The Teams

Team Shrek

shrek

  • Heather
  • Tom
  • Aziza
  • Nathan

Team Donkey

donkey

  • Christopher
  • Luke
  • Corey
  • Gary
  • Orlando

Team Puss in Boots

puss-in-boots

  • Adam
  • Stephen
  • Alexis
  • Jeff

How to work as one team

Even though you have two separate codebases and separate applications, you’re working together to ship a single product on time. You can make product decisions together even though you will implement features separately.

We’ll check in on the projects in class; front and back end teams will continue to meet separately.

Remember to read the README carefully.

🥅 Your goals tonight 🥅

  • Choose a project.
  • Understand the project requirements thoroughly and discuss what you need to build.
  • Outline a plan for what you’ll need to do.
    • This can be a text outline, sketches of user flow, basic wireframes
    • Back end will need to draw ER diagrams to plan out the models and start a list of endpoints you think you will need.
  • WRITE YOUR PLANS DOWN. You can use any tools you like as long as the content you create is shareable. Some tools that might be useful: Trello, Google Docs, Excalidraw, Miro. Make sure everyone on your team has access to this documentation.
  • You are encouraged to work with other front or back end devs on other teams to share ideas, solutions, and resources.
  • Come to your front- or back-end class meeting prepared to give progress reports and ask for help on what you’re working on.

We haven’t yet covered everything you’ll need to be able to do this project, so that will be our task this week and next.

Git Workflow

Working with other developers in a shared codebase means that the workflow you’ve been using so far will have to change. We will cover this in class together. Here are the slides for reference.

Git Collaboration slide deck

Tags: phase-3 team fe be git

🦊 React Forms and Authentication 🦊

Posted on Sep 19th, 2022

🗓️ Today’s topics

  • React Trivia review
  • Forms in React
  • Understanding what “logged in” means
  • How to handle authentication in a React application

🎯 Collaborative Project

Begin talking to your teammates and planning the team project. You should have detailed wireframes, an idea of user flow (how your user interacts with your UI), and a plan for components done by tomorrow.

Start with: What does my user see when they first land on this page? What will they do? What happens next?

🚫 No writing code yet! Today is for planning only. We’ll cover working together on GitHub tomorrow.

📖 Read | 📺 Watch | 🎧 Listen

React Mental Model

Review the core concepts of how React works by reading these visual guides.

🔖 Resources

Forms

Working with Local Storage in React

🐻 Token Authentication and CORS 🐻

Posted on Sep 19th, 2022

🗓️ Today’s Topics

  • Token authentication in DRF with Djoser
  • CORS headers

🎯 Collaborative Project

Work with your team. Tonight, plan out your models – please draw a diagram! – and write down a list of the endpoints you think you will need. It should take you some time to talk this through. What data will those endpoints have to return? Will your endpoints need to accept any data (remember you can do this in the body of the request or using part of the URL)?

Your list of planned endpoints should look something like (this is a partial list using examples from Habit Tracker. You’re going to need a bunch more endpoints than this). Keep in mind that you should include endpoints ONLY if you need them, so consider the actions that you need to support according to the project requirements.

Example planning for endpoints (you’ll need more than these, of course):

Request URL   Description
GET api/habits   returns a list of all habits for the authenticated user
GET api/habits/<int:pk>   returns details about one habit and its associated records
POST api/habits   create a new habit

🚫 No writing code yet! Today should be used for planning only. We’ll cover working together on GitHub tomorrow.

📖 Read | 📺 Watch | 🎧 Listen

🔖 Resources

Authentication

CORS

Permissions