Deployment Link: <<<<<< PUT YOUR DEPLOYMENT LINK HERE >>>>>>
The homework this week will be a little bit different! Rather than building something from scratch, you will be "remixing" code found in the 2-fellow-tracker-final-mvc/ directory of the repo below to build your own app!
https://github.com/The-Marcy-Lab-School/8-1-0-express-rest-api-model
This repository contains a server application with controllers and a model for managing a collection of Fellow objects. The repository also provides a frontend application that enables users to interact with the server's API through various forms and buttons.
You can also look at
1-fellow-tracker-finalto see the application WITHOUT the MVC architecture implemented. The functionality is the same but the file structure is simplified.
You will be tasked with "remixing" the provided application and adjusting it for the domain area of your choice. For example, you may choose to implement a Playlist API that lets users manage a list of songs or a Library API that lets users manage a list of books.
Regardless of your choice, the API should manage a collection of objects.
To get to 75% completion, you are required to build the server application (controllers and model). To get 100% on this assignment, you must build a frontend that interacts with the server. Completing both sides of the application will confirm your mastery of the material!
Remember, a server application is mostly “boilerplate” (it’s the same every time) so feel free to copy the example applications in the notes and refactor them to suit your needs. Remixing is the real challenge here, not creating from scratch.
After cloning down this repository, make a draft branch:
git checkout -b draftThen, open the example repository:
https://github.com/The-Marcy-Lab-School/8-1-0-express-rest-api-model
Next, create a server directory for your server application and set up the dependencies and file structure:
-
Create a
package.jsonfile -
Install dependencies:
expressnodemon(developer dependency)
-
Setup the file structure to match the example repository, updating the file names according to your chosen domain area:
server/ ├── index.js ├── controllers/ │ └── fellowControllers.js ├── models/ │ └── Fellow.js └── utils/ └── getId.js -
Get building!
Below, you will find the technical requirements for this assignment.
There are a total of 20 total requirements:
- 6 model requirements
- 8 endpoint/controller requirements
- 1 deployment requirement
- 5 frontend requirements
- A collection of objects is managed by the server API
- Every object in the collection has a unique
idand at least two (2) additional properties
-
Interactions with the data are provided by a
classwith at least:- a
staticmethod to create a new resource. - a
staticmethod to read existing resources (either all or one at a time). - a
staticmethod to update an existing resource. - a
staticmethod to delete an existing resource.
- a
- The server has endpoints including at least:
- one
GETmethod - one
POSTmethod - one
PATCHmethod with a route parameter for:id - one
DELETEmethod with a route parameter for:id
- one
- The server can parse JSON in incoming requests with
express.json()middleware - All endpoints begin with
/api - All endpoints use plural nouns (e.g.
/api/fellows), NOT verbs (e.g./api/getFellows) - Error codes are used appropriately (see below for error code information):
- Your application is deployed using Render and the public URL is added to the top of this README.
- The server serves a frontend application at
/usingexpress.static()middleware. - The frontend application can send a
GET requestfor and render the collection of resources from the server's "database" - The frontend application can send a
POST requestto create a new resource in the server's "database". - The frontend application can send a
PATCH requestto update an existing resource in the server's "database". - The frontend application can send a
DELETE requestto delete an existing resource in the server's "database".
The following error codes are commonly used by APIs
- Success Responses
200OK — Standard success (GET, PUT, DELETE).201Created — Resource was created (POST).204No Content — Successful but no response body (e.g. DELETE or empty PATCH).
- Client Errors
400Bad Request — Input is invalid (e.g. missing fields, bad JSON).404Not Found — Resource doesn’t exist (e.g. user ID not found).
- Server Errors
500Internal Server Error — Unexpected error on your backend.503Service Unavailable — Server is overloaded or down (e.g. maintenance or unavailable 3rd party API).