{ "name": "graphql-sync", "version": "0.5.0-sync.1", "description": "Promise-free wrapper for GraphQL.", "main": "lib/index.js", "files": [ "README.md", "LICENSE", "package.json", "lib" ], "directories": { "lib": "lib" }, "babel": { "presets": [ "es2015" ], "plugins": [ "transform-class-properties", "transform-flow-strip-types", "transform-object-rest-spread" ] }, "scripts": { "dist": "babel -d lib/ src/", "prepublish": "npm run dist" }, "repository": { "type": "git", "url": "git+https://github.com/arangodb/graphql-sync.git" }, "author": { "name": "Alan Plum", "email": "me@pluma.io" }, "license": "BSD-3-Clause", "bugs": { "url": "https://github.com/arangodb/graphql-sync/issues" }, "homepage": "https://github.com/arangodb/graphql-sync#readme", "dependencies": { "graphql": "^0.5.0" }, "devDependencies": { "babel-cli": "6.6.5", "babel-eslint": "6.0.2", "babel-plugin-transform-class-properties": "6.6.0", "babel-plugin-transform-flow-strip-types": "6.7.0", "babel-plugin-transform-object-rest-spread": "6.6.5", "babel-preset-es2015": "6.6.0" }, "readme": "# GraphQL-sync\n\nThis is a promise-free wrapper of [GraphQL.js](https://github.com/graphql/graphql-js) for [ArangoDB](https://www.arangodb.com) that replaces all asynchronous code with synchronous equivalents.\n\n## Getting Started\n\nAn overview of GraphQL in general is available in the\n[README](https://github.com/facebook/graphql/blob/master/README.md) for the\n[Specification for GraphQL](https://github.com/facebook/graphql).\n\n### ArangoDB example\n\nYou can use GraphQL-sync in [ArangoDB](https://www.arangdb.com) to build your own GraphQL endpoints directly inside the database using the [Foxx](https://www.arangodb.com/foxx) framework.\n\nAn example Foxx service using GraphQL-sync is available as [demo-graphql](https://github.com/arangodb-foxx/demo-graphql) in the Foxx service store. You can find out more about using GraphQL with Foxx in the ArangoDB blog article [*Using GraphQL with NoSQL database ArangoDB*](https://www.arangodb.com/2016/02/using-graphql-nosql-database-arangodb/).\n\n### Using GraphQL-sync\n\nInstall GraphQL-sync from npm\n\n```sh\nnpm install --save graphql-sync\n```\n\nGraphQL-sync provides two important capabilities: building a type schema, and\nserving queries against that type schema.\n\nFirst, build a GraphQL type schema which maps to your code base.\n\n```js\nimport {\n graphql,\n GraphQLSchema,\n GraphQLObjectType,\n GraphQLString\n} from 'graphql-sync';\n\nvar schema = new GraphQLSchema({\n query: new GraphQLObjectType({\n name: 'RootQueryType',\n fields: {\n hello: {\n type: GraphQLString,\n resolve() {\n return 'world';\n }\n }\n }\n })\n});\n```\n\nThis defines a simple schema with one type and one field, that resolves\nto a fixed value. The `resolve` function can return a value, a promise,\nor an array of promises.\n\nThen, serve the result of a query against that type schema.\n\n```js\nvar query = '{ hello }';\n\nvar result = graphql(schema, query);\n\n// Prints\n// {\n// data: { hello: \"world\" }\n// }\nconsole.log(result);\n```\n\nThis runs a query fetching the one field defined. The `graphql` function will\nfirst ensure the query is syntactically and semantically valid before executing\nit, reporting errors otherwise.\n\n```js\nvar query = '{ boyhowdy }';\n\nvar result = graphql(schema, query);\n\n// Prints\n// {\n// errors: [\n// { message: 'Cannot query field boyhowdy on RootQueryType',\n// locations: [ { line: 1, column: 3 } ] }\n// ]\n// }\nconsole.log(result);\n```\n\n### License\n\nGraphQL is [BSD-licensed](https://github.com/graphql/graphql-js/blob/master/LICENSE).\nFacebook also provides an additional [patent grant](https://github.com/graphql/graphql-js/blob/master/PATENTS).", "readmeFilename": "README.md", "gitHead": "f49bafbba0219fbf1c28722a9282f983ba753f3f", "_id": "graphql-sync@0.5.0-sync.1", "_shasum": "3d8a77ced99d0a659bcdf37d9afd26be3825edc4", "_from": "graphql-sync@latest" }