This repository has been archived by the owner on Oct 2, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 512
London10_Afsha_Hossain_Node_Week1_quote-server #324
Open
Afsha10
wants to merge
10
commits into
CodeYourFuture:master
Choose a base branch
from
Afsha10:feature/quote-server-project
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
London10_Afsha_Hossain_Node_Week1_quote-server #324
Afsha10
wants to merge
10
commits into
CodeYourFuture:master
from
Afsha10:feature/quote-server-project
Conversation
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
Added a /quotes route using Glitch and VS code: https://afsha1-quote-server.glitch.me/quotes localhost:3000/quotes Add a /quotes/random route using Glitch and VS code: https://afsha1-quote-server.glitch.me/quotes/random localhost:3000/quotes/random
In this level of the challenge I have allowed the user of my quotes API to search my list of quotes. Added a /quotes/search?term route using Glitch and VS code: https://afsha1-quote-server.glitch.me/quotes/search?term=life https://afsha1-quote-server.glitch.me/quotes/search?term=success https://afsha1-quote-server.glitch.me/quotes/search?term=miss localhost:3000/quotes/search?term=life localhost:3000/quotes/search?term=success localhost:3000/quotes/search?term=miss
Making a simple test route that takes a query parameter and repeats the word back to the user. Tested: https://afsha1-quote-server.glitch.me/echo?word=ismail localhost:3000/echo?word=ismail
Used a library called lodash to make it simpler to do tasks like picking randomly from an array. Tested: https://afsha1-quote-server.glitch.me/quotes/random localhost:3000/quotes/random To install the lodash library: - edited the file package.json... - added a line for lodash in the dependencies (we'll already see one for "express"). - We can use "*" as the version number for now. - If we're running locally, we will need to run npm install to set up the dependency. If we're using Glitch, it will automatically install it. - Added a "require" line in your server.js so that we can use the library. - const lodash = require('lodash'); then we can use use code inside the pickFromArray function lodash.sample(myArray)
- Made a very simple React app and named it quotes-react-app - Had it fetch a random quote from your server on glitch. We had to enable CORS on the express app. See below. We installed and enabled CORS in order to allow our JSON to be loaded from a different server (glitch.me) than our React app was initially loaded (probably netlify.com). in package.json added a dependency for "cors": "^2.8.5" Then in our server.js added... var cors = require('cors') and app.use(cors()) Then we host our react app on netlify
Made sure the search term in the search end point is also case insensitive by adding .toLowerCase() to searchQuery.
Afsha10
force-pushed
the
feature/quote-server-project
branch
from
July 20, 2023 17:32
e42f8d7
to
b8ecc0b
Compare
Added my own theory and some of my favourite quotes by Nietzshe.
Afsha10
force-pushed
the
feature/quote-server-project
branch
from
July 20, 2023 18:53
b8ecc0b
to
4e027c9
Compare
Afsha10
force-pushed
the
feature/quote-server-project
branch
from
August 25, 2023 23:51
4fa4083
to
9aef9f0
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Volunteers: Are you marking this coursework? You can find a guide on how to mark this coursework in
HOW_TO_MARK.md
in the root of this repositoryYour Details
Homework Details
Notes
What did you find easy?
What did you find hard?
What do you still not understand?
Any other notes?