GraphQL little something

node v6.17.1
version: 0.0.1
endpointsharetweet
var { graphql, GraphQLSchema: Schema, GraphQLObjectType: ObjectT, GraphQLString: StringT, GraphQLScalarType: ScalarT, } = require('graphql'); require('babel-runtime/core-js/object/values'); require('graphql-tools'); var { mergeTypes } = require('merge-graphql-schemas'); var Query = new ObjectT({ name: 'query', fields: () => ({ get: { type: StringT, resolve() { return 'sometihng getted'; }, }, scal: { type: new ScalarT({ name: 'scalarius', serialize: (value) => value, }), resolve() { return [{ a: 1, b: 2, }, { c: 3, }] }, } }), }); var schema = new Schema({ query: Query, }); graphql(schema, `{ get, scal }`).then((result) => { console.log(result); });
Loading…

no comments

    sign in to comment