This repository contains a modern JavaScript application designed to integrate with the Yelp Fusion API to search for and display local food and restaurant data. It serves as a practical example of fetching, structuring, and displaying data from a third-party API in a front-end application.
Based on the file structure (JavaScript files, package.json, app.json), this project is likely built using React Native (or standard React) for the UI and leverages core JavaScript features for API interaction.
- Primary Language: JavaScript
- API: Yelp Fusion API (for fetching restaurant data, reviews, and images).
- Front-end Framework: Likely React or React Native (given
App.jsand configuration files). - Networking: Likely uses
axiosor nativefetchfor API calls.
- Restaurant Search: Allows users to search for food businesses based on keywords (e.g., "pizza," "sushi").
- Location-Based Results: Fetches results relevant to a specific location (or device location).
- Detailed Views: Displays essential information for each business, such as name, rating, address, price range, and image.
- API Key Management: Includes best practices for securely handling the Yelp API Key.
Follow these instructions to set up and run the project locally.
- Node.js (LTS recommended)
- npm or yarn
- Yelp Fusion API Key: You must register for an account and obtain an API key from the Yelp Developers website.
-
Clone the repository:
git clone [https://github.com/rayancmorais/YelpFoodAPI.git](https://github.com/rayancmorais/YelpFoodAPI.git) cd YelpFoodAPI -
Install dependencies:
npm install # or # yarn install
-
Configure API Key:
To secure your sensitive API key, you should use environment variables (e.g., via a
.envfile or similar mechanism).a. Create a file named
.envin the root directory. b. Add your Yelp API key to the file:# .env YELP_API_KEY="Bearer <YOUR_YELP_FUSION_API_KEY_HERE>"Note: The API key must be prefixed with
Bearerfor proper authentication. Ensure you update your API configuration file (likely in thesrcfolder) to correctly import and use this environment variable.
-
Start the development server:
npm start # or # yarn start
-
Follow the instructions in your terminal to view the application:
- React: Open the provided
localhostURL in your web browser. - React Native/Expo: Use the Expo Go app on your mobile device to scan the QR code.
- React: Open the provided
The key files and directories are organized as follows:
YelpFoodAPI/
├── assets/- Images, fonts, and other static assets.
├── src/- Contains the core application source code.
├── .env- Environment variables (like the API key).
├── App.js- Main application entry point.
├── package.json- Project dependencies and scripts.
└── ...- (Other standard files like
.gitignore,README.md, etc.).
- (Other standard files like
The src/ directory is organized into the following subdirectories:
├── src/components/- Reusable UI components (e.g.,
SearchBar,BusinessCard).
- Reusable UI components (e.g.,
├── src/screens/- Main application screens (e.g.,
SearchScreen,DetailScreen).
- Main application screens (e.g.,
└── src/api/- Logic for API communication and setup (e.g., Yelp API).