Giter Site home page Giter Site logo

douglasmackrell / foursquare-app Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 1.82 MB

An app designed around using Foursquare's API in conjunction with Mapbox to showcase the 10 closest Mexican restaurants based on the user's geolocation.

Home Page: https://beholdburrito.herokuapp.com

HTML 16.58% CSS 10.85% JavaScript 72.57%
foursquare-api foursquare mapbox

foursquare-app's Introduction

Behold Burrito

Behold Burrito Social Media

Behold Burrito is a Full Stack Web App created to quickly show a user the 10 closest Mexican restaurants to their current location.

The site is 100% ad free, and designed for ease of use, so users can find their feast fast!

Behold Burrito Site Demo

Features

Users are able to:

  • After allowing the site to access to their geolocation, the app automatically loads the 10 closest Mexican restaurants in proximity to the user.

This is accomplished by:

  • Making a call to the Foursquare API based on the latitude and longitude of the user
    • This is queried in a way to return only the ten closest Mexican restaurants, listed in ascending order by distance in meters
  • Making a call to the Mapbox API based off the returned data from Foursquare
  • Displaying this to the user via a generated Mapbox map on the top half of the screen
    • The red pin is the user's current location
    • The blue pins are the discovered locations
    • The blue pins can be clicked to reveal a data popup displaying the name of the restaurant and its specific address
      • These popups can be dismissed by an X button in the upper right, or can be swapped by clicking a new blue pin
    • Based on the furthest location from the user (in meters), the app automatically calculates and adjusts the zoom so all pins can be displayed
  • Below the map is a list of all the discovered Mexican restaurants in ascending order
    • Each list item is also a link to a google search run on the restaurant's name - with the goal of giving the user the website for the restaurant, or more information via the google search database

Future Features

  • An input for users who don't wish to or can't share their geolocation - so they can manually enter a search

Technical Milestones

  • Utilizing the Foursquare API
  • Utilizing the Mapbox API
  • Handling faults with react-map-gl npm package
  • Obscuring/blocking secret API keys/tokens from malicious users
  • Displaying multiple pins on a generated map after a call to a separate external API
  • Utilizing WebMercatorViewport within react-map-gl to calculate a bounding box based on the user's geolocation and the latitude and longitude of the furthest pin to automatically zoom the map so all pins are displayed to the user no matter the distance
  • Forcing HTTPS within Heroku to ensure geolocation is not bloked

Technologies Used

  • Node.js & Express.js For the HTTP backend server
  • React.js For the front-end/client interface of my app
  • Foursquare API To handle all exploration data requests
  • react-map-gl For generating the map within a React project
  • Mapbox API The API being called by react-map-gl
  • CSS3
  • Heroku For deployment

Local Setup

NOTE: This repo has been configured for deployment on Heroku, but can be run locally after a few adjustments.

You must install Node.js in your computer.

You can check for these dependencies with node -v. If your shell/terminal doesn't complain and you see version numbers you are good to go.

  1. Clone this repo into a folder of your choice:

    git clone https://github.com/DouglasMacKrell/foursquare-app.git
    
  2. Install dependencies for the Node/Express Server:

    cd backend && npm install
    
  3. Install dependencies for the React App (client folder):

    cd ../frontend && npm install
    
  4. To launch the Node/Express server, inside the backend folder run:

    cd ..
    npm start
    
  5. Before you can launch the React App, you must target your local server within App.js that use this connection for axios calls. In the frontend => src folder, open the App.js file.

    • On line 54, change

      `https://beholdburrito.herokuapp.com/api/venues/${latLong}`
      
    • to

      `http://localhost:3001/api/venues/${latLong}`
      
  6. To launch the React App, inside the frontend folder, and preferably in another terminal window run:

    npm start
    
  7. A new browser tab should have been opened and the App should be running. If that is not the case check the terminals output for errors, if you are unable to troubleshoot the problem, I would be happy to address issues so open one

  8. NOTE: You must secure your own API keys & tokens from Foursquare and Mapbox. The Mapbox token used here will only work for https://beholdburrito.herokuapp.com. At time of writing both have free developer accounts with no money/credit card info up front. Store your Foursquare keys in an .env file in the backend and swap out your Mapbox accessToken for the one I list in the frontend.


Please check out my other work at DouglasMacKrell.com


Douglas MacKrell


Before you leave, please take note:

You're the best! Thank you for visiting!

Please give this project a star and be sure to check out my YouTube Channel!

foursquare-app's People

Contributors

douglasmackrell avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.