Skip to content

Instantly share code, notes, and snippets.

@alanmynah
Last active June 17, 2019 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanmynah/48b6ee4452b63d19afc0a2a737a5aeb2 to your computer and use it in GitHub Desktop.
Save alanmynah/48b6ee4452b63d19afc0a2a737a5aeb2 to your computer and use it in GitHub Desktop.
AmazingRecipes initial setup
<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