{"id":19986033,"url":"https://github.com/cpilson/yelp-fusion-api-test","last_synced_at":"2026-04-09T16:05:28.101Z","repository":{"id":230866447,"uuid":"119909552","full_name":"cpilson/yelp-fusion-api-test","owner":"cpilson","description":"Yelp Fusion API Test","archived":false,"fork":false,"pushed_at":"2018-02-05T04:12:12.000Z","size":423,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-17T13:33:43.636Z","etag":null,"topics":["api","cors","heroku-instance","react","react-router","reactjs","redux","tutorial","tutorial-code","yelp","yelp-api","yelp-fusion-api"],"latest_commit_sha":null,"homepage":"https://yelp-fusion-api-test.herokuapp.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cpilson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-02T00:15:38.000Z","updated_at":"2020-07-31T13:19:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"91f55add-c42e-4ad3-9e14-1e3e909395f1","html_url":"https://github.com/cpilson/yelp-fusion-api-test","commit_stats":null,"previous_names":["cpilson/yelp-fusion-api-test"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cpilson/yelp-fusion-api-test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpilson%2Fyelp-fusion-api-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpilson%2Fyelp-fusion-api-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpilson%2Fyelp-fusion-api-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpilson%2Fyelp-fusion-api-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cpilson","download_url":"https://codeload.github.com/cpilson/yelp-fusion-api-test/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpilson%2Fyelp-fusion-api-test/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270856563,"owners_count":24657688,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","cors","heroku-instance","react","react-router","reactjs","redux","tutorial","tutorial-code","yelp","yelp-api","yelp-fusion-api"],"created_at":"2024-11-13T04:27:33.633Z","updated_at":"2026-04-09T16:05:28.064Z","avatar_url":"https://github.com/cpilson.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Yelp Fusion API Test\n\n## What This Repository Demonstrates\n\nThis repository is a quick test of CORS and CORS-anywhere methods to access the `Yelp Fusion (v3) API` under React 16. [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) fails in the client-side browser (due to `Yelp` failing to return an `Access-Control-Allow-Origin` header), hence the required use of `CORS-Anywhere`.\n\nIf you're getting feedback from e.g. Chrome showing the following error when trying to contact the Yelp API, then you'll need the information this repository provides.\n\n```text\nFailed to load https://api.yelp.com/v3/businesses/search?term=pizza\u0026latitude=33.389757599999996\u0026longitude=-111.9343636\u0026limit=25:\nResponse to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.\nOrigin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 403.\n```\n\n## How to Use This Repository\n\nTo use this repo to demonstrate the Yelp API issue, and demonstrate a work-around:\n\n* [Build the local client](#build-the-client-locally)\n* [Build the CORS-Anywhere helper](#build-and-push-a-cors-anywhere-helper-service-to-heroku)\n* [Configure your `.env` file to point at your CORS-Anywhere helper instance](#configure-local-instance-with-your-cors-anywhere-heroku-instance)\n* Run locally with `yarn start`. This should open your default web browser to `http://localhost:3000`.\n\n### Build the Client Locally\n\n* Clone this repo into a local folder\n* Type `yarn install` to add all the dependencies.\n* Rename `.env-sample` to `.env`, and replace the `REACT_APP_YELP_API_key` value with your own. Also replace the `REACT_APP_CORS_ANYWHERE_URL` value with your own Heroku build of the CORS-Anywhere package.\n\n### Build and Push a CORS-Anywhere Helper Service to Heroku\n\nThis app requires use of [Rob--W's](https://github.com/Rob--W/cors-anywhere/) [CORS-Anywhere Helper Service](https://cors-anywhere.herokuapp.com/) to proxy Yelp API calls made from client code running in a web browser.\n\nDefinitely look at [Rob--W's GitHub repository](https://github.com/Rob--W/cors-anywhere/), but you can deploy your own Heroku build of CORS-Anywhere by doing the following:\n\n* Change to a local directory that holds your GitHub repos. For example, my own GitHub repos all live under `~/Documents/GitHub` (or `C:\\Users\\Chris\\Documents\\GitHub` if I'm on Windows)\n* `git clone https://github.com/Rob--W/cors-anywhere.git`\n* `cd cors-anywhere/`\n* `npm install` or `yarn install`, depending on which package manager you're using. I tend towards `yarn` these days.\n* `heroku create` (Assuming you already have the Heroku CLI tools installed)\n* `git push heroku master`\n\nThese steps will give you a site running the CORS-Anywhere code out on Heroku. It's randomized and slugified, so your site name may be something like `https://shrouded-basin-35126.herokuapp.com/`\n\n### Configure Local Instance with Your CORS-Anywhere Heroku Instance\n\nIn your `.env` file, replace the default value for `REACT_APP_CORS_ANYWHERE_URL` with your Heroku server instance of CORS-Anywhere.\n\n## Optional: Build a Heroku-Based Client\n\n* See https://github.com/mars/create-react-app-buildpack for information on Heroku deployment if you want to deploy this client-side code to Heroku.\n\n  * NOTE: Heroku won't work with `dotenv`, which I'm using here for local testing.\n  * Instead, set up the Heroku environment variables thusly:\n\n    ```text\n    heroku config:set REACT_APP_YELP_API_key=\"\u003cvalue from your .env file\u003e\" REACT_APP_CORS_ANYWHERE_URL=\"\u003cvalue from your .env file\u003e\"\n    ```\n\n    Do not forget to also add `heroku config:set NODE_ENV=production` to tell Heroku that you want a _production_ build of the app, rather than a _development_ build!\n\n    * You can also edit config vars on your app’s settings tab on your Heroku Dashboard, at `https://dashboard.heroku.com/apps/YOUR-APP-NAME/settings`.\n\n* Visit https://dashboard.heroku.com/apps to see a list of _your_ applications deployed on Heroku.\n\n* Make sure your GIT repo is up-to-date, then `git push heroku master` should push the `master` branch of the `yelp-fusion-api-test` repo out to Heroku for production use.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpilson%2Fyelp-fusion-api-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcpilson%2Fyelp-fusion-api-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpilson%2Fyelp-fusion-api-test/lists"}