Socket
Socket
Sign inDemoInstall

graphql-binding-yelp

Package Overview
Dependencies
22
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    graphql-binding-yelp

Embed Yelp's GraphQL API into your server application


Version published
Weekly downloads
1
Maintainers
1
Install size
3.02 MB
Created
Weekly downloads
 

Readme

Source

GraphQL Binding for Yelp

Embed Yelp's GraphQL API into your server application

Install

yarn add graphql-binding-yelp

Example (Demo @TODO)

See example directory for full example application.

const { Yelp } = require("graphql-binding-yelp");
const { GraphQLServer } = require("graphql-yoga");
const { importSchema } = require("graphql-import");

const favoriteBusinesses = [
  { term: "Wawa", location: "Winter Garden, FL" },
  { term: "7-Eleven", location: "Winter Garden, FL" }
];

const apiKey = "__ENTER_YOUR_YELP_API_KEY__";
const yelp = new Yelp(apiKey);

const typeDefs = importSchema("schemas/app.graphql");
const resolvers = {
  Query: {
    hello: (parent, { name }) => `Hello ${name || "world!"}`,
    favoriteBusinesses: (parent, args, context, info) => {
      return Promise.all(
        favoriteBusinesses.map(args =>
          yelp.delegate("query", "search", args, context, info)
        )
      );
    }
  }
};

const server = new GraphQLServer({ resolvers, typeDefs });
server.start(() => console.log("Server running on http://localhost:4000"));

How to create a Yelp API Key

You’ll need to create a client, join the beta program, and grab the API key from your client settings.

FAQs

Last updated on 20 Jan 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc