Last active
June 17, 2019 06:08
-
-
Save alanmynah/48b6ee4452b63d19afc0a2a737a5aeb2 to your computer and use it in GitHub Desktop.
AmazingRecipes initial setup
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
<html> | |
<head> | |
<script src="https://unpkg.com/react@16/umd/react.development.js"></script> | |
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script> | |
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script> | |
<style> | |
/* | |
PASTE CSS HERE (Optional) | |
*/ | |
</style> | |
</head> | |
<body> | |
<div id="root"></div> | |
<script type="text/babel"> | |
const getData = async (search) => { | |
const proxyurl = "https://cors-anywhere.herokuapp.com/"; | |
const url = `http://www.recipepuppy.com/api/?q=${search}`; | |
const response = await fetch(proxyurl + url).catch(() => | |
console.log("Can’t access " + url + " response. Blocked by browser?") | |
); | |
const json = await response.json(); | |
return json.results; | |
}; | |
/* | |
ADD REACT CODE HERE | |
*/ | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment