Skip to content

A GraphQL node wrapper for the Fantasy Premier League (fantasy.premierleague.com) REST apis.

License

Notifications You must be signed in to change notification settings

tgreyuk/fpl-api-graphql

Repository files navigation

fpl-api-graphql

DEPRECATED

Package no longer actively maintained.

Installation

npm install fpl-api-graphql --save

Usage

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 or apollo-server.

Example

This example uses express-graphql to serve over http and graphql-tools to build an executable schema.

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 IDE will also be available in the browser.

TODO

  • More documentation
  • Unit tests

About

A GraphQL node wrapper for the Fantasy Premier League (fantasy.premierleague.com) REST apis.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •