Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devanb/graphql-binding-yelp
Embed Yelp's GraphQL API into your server application
https://github.com/devanb/graphql-binding-yelp
graphql graphql-schema schema-stitching yelp-api
Last synced: about 1 month ago
JSON representation
Embed Yelp's GraphQL API into your server application
- Host: GitHub
- URL: https://github.com/devanb/graphql-binding-yelp
- Owner: DevanB
- Created: 2017-12-09T04:41:09.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-20T03:37:13.000Z (almost 6 years ago)
- Last Synced: 2024-10-11T13:20:52.851Z (about 1 month ago)
- Topics: graphql, graphql-schema, schema-stitching, yelp-api
- Language: TypeScript
- Size: 29.3 KB
- Stars: 10
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GraphQL Binding for Yelp
Embed Yelp's GraphQL API into your server application
## Install
```sh
yarn add graphql-binding-yelp
```## Example ([Demo @TODO](@TODO))
See [example directory](example) for full example application.
```js
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.