Skip to content

Instantly share code, notes, and snippets.

@timothyandrew
Last active November 29, 2022 10:13
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 timothyandrew/56eea2c0639c04085f346f8a4988efef to your computer and use it in GitHub Desktop.
Save timothyandrew/56eea2c0639c04085f346f8a4988efef to your computer and use it in GitHub Desktop.
Formulate Gallery: Lunch
export default {
async fetch(request, env) {
let url = 'https://api.yelp.com/v3/businesses/search';
let location = 'Liverpool Street, London';
let apiResponse = await fetch(`${url}?term=restaurants&location=${location}&price=1,2&open_now=1&limit=6&radius=800`, {
headers: {
'Authorization': `Bearer ${env.YELP_API_KEY}`,
}
});
let response = new Response(apiResponse.body, apiResponse);
response.headers.set('Access-Control-Allow-Origin', 'https://formulate.dev');
response.headers.set('Access-Control-Allow-Methods', 'GET');
return response;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment