generated from Technigo/express-api-starter
-
Notifications
You must be signed in to change notification settings - Fork 529
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
Anna2024WebDev
wants to merge
6
commits into
Technigo:master
Choose a base branch
from
Anna2024WebDev:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8424dd1
added json file for cats, created first route with a category query f…
Anna2024WebDev 6d08640
added filter for fur length and find id for cat and added error handl…
Anna2024WebDev 2a5b2f5
added array method for find a specific breed and changed the other fi…
Anna2024WebDev 9df642a
fixed issue with conflicting routes
Anna2024WebDev 822e1d8
updated readme and comments in js file
Anna2024WebDev 47651df
updated readme
Anna2024WebDev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
## 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/ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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)There was a problem hiding this comment.
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.