0.4.1 • Published 6 years ago

@parse-graphql/schema v0.4.1

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Parse GraphQL Schema npm (scoped) CircleCI

WIP

Project Goals

The goal of this project is to generate a GraphQL schema that supports most of the Parse API, without having much support for customization in this library. A lot of customization can be done on the parse-server side, or the generated types can be imported and you can add them to your own custom schema.

Install

yarn add @parse-graphql/schema

or

npm install --save @parse-graphql/schema

Usage

This library can be used directly and served over any protocol, but you might want to start with parse-graphql-express.

Example usage:

import generateSchema from '@parse-graphql/schema';
import { graphql } from 'graphql';

const schema = generateSchema({
  appId: "foo",
  masterKey: "bar",
  serverURL: "https://foobar.com/parse"
});

const query = `
  query {
    someClass {
      name
    }
  }
`;

graphql(schema, query).then(result => {
  console.log(result);
});

To make authenticated requests, pass in a context with property sessionToken set to the sesion token of the current user:

graphql(schema, query, null, { sessionToken })
  .then(result => {
    // ...
  });