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

FoodScout #15

Open
Mi-Br opened this issue Nov 21, 2019 · 13 comments
Open

FoodScout #15

Mi-Br opened this issue Nov 21, 2019 · 13 comments

Comments

@Mi-Br
Copy link

Mi-Br commented Nov 21, 2019

Purchasing food products without any knowing what ingredients it contains, nutrition and potentially harmfull substances is a common consumer behaviour. As a result we have seen increased number of Diabetes, Cancer, Heart deceases
FoodScout is on a mission to bring transparency and risk, so that consumer can make informed buy decision
Nutritionix API
Full Description

@Mi-Br
Copy link
Author

Mi-Br commented Nov 21, 2019

Submitted / Description under review 🙏

@w3cj
Copy link
Member

w3cj commented Nov 21, 2019

Looks good! Feel free to get started.

@w3cj
Copy link
Member

w3cj commented Nov 23, 2019

How are things so far? Any updates to share?

@Mi-Br
Copy link
Author

Mi-Br commented Nov 23, 2019

Update:
Had to change API since previous is not supported (some links dont work etc). Ended up choosing:
https://rapidapi.com/spoonacular/api/recipe-food-nutrition?endpoint=56072f1fe4b0d11d571f171e
** Search Grocery Priducts API (GET)
** Get Product Information API (GET)
** Get a Random Food Joke API (GET)

@Mi-Br
Copy link
Author

Mi-Br commented Nov 23, 2019

Wireframe ready https://wireframe.cc/BgxHIK
not sure if it explains what I would like to achieve with UI , I basically want a single page with search bar, search results returned in a form of list, if user clicks on item , I then display detailed information, like list of badges (gluten free etc) as well as important nutrition information

@Mi-Br
Copy link
Author

Mi-Br commented Nov 24, 2019

Initial design and CSS completed ( it sooo time consuming ! )
Planning to start fetching data from api later today
Screenshot 2019-11-24 at 07 50 37

@w3cj
Copy link
Member

w3cj commented Dec 2, 2019

Any updates to share?

@Mi-Br
Copy link
Author

Mi-Br commented Dec 2, 2019

hi CJ,
Sure, search functionality implemented, now moving on to product view (detailed information about item)
Followed by "stretched" assignments (local storage etc.) . Not sure if we have deadline for this ? If we are pressed on time, i could revisit scope of work, otherwise I hope it will be finished by the end of this week

@Mi-Br
Copy link
Author

Mi-Br commented Dec 10, 2019

Latest update:
finished with nutrition info. I am planning to release 1.0 version after a bit of refactoring and then move on to do some stretched assignments
Screenshot 2019-12-10 at 07 26 03

@Mi-Br
Copy link
Author

Mi-Br commented Dec 14, 2019

Hi CJ,
I was wondering if you can point me in the right direction.
I am stuck at getting product details. I am using fetch, and did well requesting search results and displaying them on the page. However, when trying to implement "get product details" functionality(separate API) - I keep getting HTTP response 200, type="cors" and no results ) I have tested the same with postman, jquery - it works, but not with fetch. any tips? (here is the snapshot of my code )

function getProductDetails(id) { fetch("https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/food/products/428573/nutritionWidget", { "method": "GET", "headers": { "x-rapidapi-host": "spoonacular-recipe-food-nutrition-v1.p.rapidapi.com", "x-rapidapi-key": "c554c09a2dmsh41d2bc225d3ee89p10fb89jsn47a7e7210970", "accept": "text/html" } }) .then(response => { console.log(response); }) .catch(err => { console.log(err); }); }

@over-engineer
Copy link

Hey @Mi-Br,

fetch() returns a promise containing the response. This is just an HTTP response, not the actual HTML. To extract the HTML body content from the response, you can use the text() method

So, your code will look like this:

fetch('https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/food/products/428573/nutritionWidget', {
  headers: {
    'x-rapidapi-host': 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com',
    'x-rapidapi-key': 'c554c09a2dmsh41d2bc225d3ee89p10fb89jsn47a7e7210970',
    accept: 'text/html',
  },
})
  .then((response) => response.text()) // <-- here
  .then((data) => {
    console.log(data);
  })
  .catch((err) => {
    console.log(err);
  });

Hope this helps 😄

@Mi-Br
Copy link
Author

Mi-Br commented Dec 20, 2019

thanks a lot, it helped.
I will try to deploy foodscout today/tomorrow

@Mi-Br
Copy link
Author

Mi-Br commented Dec 22, 2019

I have finally deployed website to heroku using index.php trick
https://food-scout.herokuapp.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants