Momentum logo
Team 12 Classroom

🐻 Designing Your Models & Your API 🐻

Posted on Jun 1st, 2022

🗓️ Today’s Topics

  • Models for your collaborative project
  • Designing the urls you need
  • Review permissions & 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 WRITTEN DOWN plan 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: only build what you need.

  • What lists or collections of data will you need to return?
  • What single resources will you need to return?
  • What HTTP methods will you need to support for your urls?
  • Which routes will need to be authenticated and which do not require authentication?
  • Will you need to restrict any actions at the object level?

By Friday

Your API should…

  • be returning JSON for GET requests for questions and answers / cards and friends
  • be able to accept POST requests to create questions and answers / cards and friends

🔖 Resources

Permissions

CORS

Databases: Deeper Dive into the Theory Behind the Best Practices

👾 Code

🐻 💞 🦊 Phase 3 Collaborative Project 🦊 💞 🐻

Posted on May 31st, 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 Thunder: Gerardo, Manny, Jamie, Hillary

Team Lightning: Shawna, Joey, Stephen, Jessica

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 very 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; for back end you’ll need to draw ER diagrams to plan your 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 May 31st, 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! We’ll cover working together on GitHub tomorrow.

🔖 Resources

Forms

Working with Local Storage in React

React Mental Model

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

🐻 Token Authentication and CORS 🐻

Posted on May 31st, 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 and what data will they need to accept, if they are POST or PUT/PATCH endpoints?

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 think about the project requirements.

Example planning for endpoints:

Request URL   Description
GET api/habits   returns a list of all habits for the logged in 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! We’ll cover working together on GitHub tomorrow.

📖 Read | 📺 Watch | 🎧 Listen

🔖 Resources

Authentication

CORS

Permissions