-
Notifications
You must be signed in to change notification settings - Fork 0
Description
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:
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, andDELETErespectively, which you will be implementing in your router file. For example:router.get(...)
- Create your router file called
projectVolunteersRouteratserver/routes/. - 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
jsonstatus 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
Postman Guide
Request/Response Objects, and Asynchronous JavaScript Refresher
