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

Back to home