Skip to content

CRUD Route: Query ProjectVolunteers Table #38

@Satchel05

Description

@Satchel05

At a glance

You will be building a CRUD (Create, Read, Update, Delete) Route that will allow the frontend to query the backend. The route acts as the middle man between the frontend and backend.

Context In the Larger Project

This issue builds upon #37

Here is how this table will fit into the logical flow of the project:

Image

Technical Details

What is a route?

A route acts as the middle man between the frontend and backend.

What is a CRUD route?

A Create Read Update Delete route is a specific type of route that falls under the umbrella of tools that allows developers to interact with RESTful apis.

Conveniently, these operations align with the standard HTTP methods of POST, GET, PUT, and DELETE respectively, which you will be implementing in your router file. For example: router.get(...)

  1. Create your router file called projectVolunteersRouter at server/routes/.
  2. Create the necessary CRUD operations (all four of the operations listed above) but you will end up with more than four as you query more specific pieces of data like individual project volunteers rather than all project volunteers.

Acceptance Criteria

All required routes implemented.

Learning Goals

What's Important To Understand:

  • Testing in Postman
  • What a CRUD route is and how to outline its general structure
  • Request and Response Bodies, Response Headers

What's Not Important To Understand:

  • perfectly understand how every operation works. Your partner may take two and you take two. That's okay. You will get much more experience with writing more routes as the project progresses. If you feel shaky on this, you should also try to bid for issues that include more backend work. If you understand one operation, it's pretty easy to adapt the logic to the other operations.
  • Inner workings of express like the exact implementation details of sending out json status codes and error messages. Implementation differs considerably on this point. Just run with our current structure and make sure you understand generally what's happening.

Further Notes For Learning Purposes

Our current structure integrates two elements of routing that is traditionally separated in larger projects. Typically with these larger ones, you would have a controller directory that implements that CRUD operations, and a routes directory that simply specifies the HTTP method and URL. This becomes useful because you can avoid combing through large complex queries and see a broader overview of what routes are required for the frontend by looking at the routes directory. The underlying implementation is abstracted away into the controller directory.

Resources

Tech Leads we love you! Pester us with questions

CRUD Routes and Alternatives

Postman Guide

Request/Response Objects, and Asynchronous JavaScript Refresher

Past CTC project's CRUD route implementation

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions