This is now supported out of the box by parse server
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.
yarn add @parse-graphql/schema
or
npm install --save @parse-graphql/schema
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 => {
// ...
});