Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tgreyuk/fpl-api-graphql
A GraphQL node wrapper for the Fantasy Premier League (fantasy.premierleague.com) REST apis.
https://github.com/tgreyuk/fpl-api-graphql
Last synced: about 2 months ago
JSON representation
A GraphQL node wrapper for the Fantasy Premier League (fantasy.premierleague.com) REST apis.
- Host: GitHub
- URL: https://github.com/tgreyuk/fpl-api-graphql
- Owner: tgreyuk
- License: mit
- Created: 2018-10-17T13:27:37.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-01-05T04:35:06.000Z (almost 4 years ago)
- Last Synced: 2024-03-03T07:36:47.004Z (10 months ago)
- Language: TypeScript
- Homepage:
- Size: 183 KB
- Stars: 9
- Watchers: 3
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fpl-api-graphql
## DEPRECATED
Package no longer actively maintained.
## Installation
```bash
npm install fpl-api-graphql --save
```## Usage
```js
const { typeDefs, resolvers } = require('fpl-api-graphql');
```The package exposes GraphQL `typeDefs` (a schema description as a GraphQL type language string) and `resolvers`.
There are no assumptions about the implementation. If serving over http the package would typically be consumed with either [express-graphql](https://github.com/graphql/express-graphql) or [apollo-server](https://github.com/apollographql/apollo-server).
## Example
This example uses [express-graphql](https://github.com/graphql/express-graphql) to serve over http and [graphql-tools](https://github.com/apollographql/graphql-tools) to build an executable schema.
```js
const express = require('express');
const graphqlHTTP = require('express-graphql');
const { makeExecutableSchema } = require('graphql-tools');
const { typeDefs, resolvers } = require('fpl-api-graphql');// build executable schema from typedefs and resolvers
const schema = makeExecutableSchema({ typeDefs, resolvers });// express app
const app = express();// graphql
app.use(
'/graphql',
graphqlHTTP({
schema,
graphiql: true,
}),
);// serve
app.listen(3000, () => {
console.log(`express-graphql demo running on port 3000`);
});
```The GraphQL server will be available at http://localhost:3000/graphql and the [GraphiQL](https://github.com/graphql/graphiql) IDE will also be available in the browser.
## TODO
- More documentation
- Unit tests