Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project Express API by Anna #520

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Project Express API

Replace this readme with your own information about your project.
This week we started with backend and our first project was to create an express API. This was done by using a json file that I got with help from chatGPT. Since I love cats I asked for 55 cat breeds including information on fur length, personality, commonality and more.

Start by briefly describing the assignment in a sentence or two. Keep it short and to the point.
I started out by planning for which endpoints and routes to have and decided to have one filter query parameters and conditionals- if/else statements for all cats and filtered by personality, fur_length, or commonality. And then I wanted separate route parameters for breed and ID and used the find method for that. I also added error handling to all routes.

## The problem

Describe how you approached to problem, and what tools and techniques you used to solve it. How did you plan? What technologies did you use? If you had more time, what would be next?
I looked a lot at Matildas live session where she had different examples of query parameters or route parameters and filtering or find methods. I think it was very straight forward but I had one problem with the find method and route paths, there was a conflict between the routes for breed and ID so I needed to add more unique path to the cats breed. "/cats/breed/:breed" instead of "/cats/:breed" which worked.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The most RESTful thing would've been to put the breed as a query param (/cats?breed=bengal) instead of creating its own route. This way, you've still named the endpoint after what it returns: cats (filtered on breed)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that first but then it said in the requirements that we should have "A minimum of one endpoint to return a single result (single element)." so then I added it as a route parameter so I had 2 of the single element endpoints.


## View it live

Every project should be deployed somewhere. Be sure to include the link to the deployed project so that the viewer can click around and see what it's all about.
https://project-express-api-cats.onrender.com/
Loading