feathers-apollo-server
A feathers-apollo-server plugin for apollo graphql server integration with feathers minimalist real-time framework
Installation
npm install feathers-apollo-server --save
Documentation
graphqlServer({typeDefs,resolver,[opts]},[extraOpts],[graphiqlOpts])
// setup const typeDefs = `type Query{ testString:String}schema{ query:Query}`; const resolvers = Query: { 'use strict'; return 'this is a test string'; } ; const Opts=path:'/graphql'schemaresolvers //makeExecutable schema optionsconst extraOpts=context:key:"context_Value" // graphql server options: // Register the plugin, see below for an exampleapp;
Plugin Args
Opts:
The same as makeExecutableSchema options. path,typeDefs and resolvers are required while other arguments are optional,learn more options from graphql-tools
extraOpts(Optional): graphql express options, you can learn more here
graphiqlOpts: Same as graphiql Options except for the grapiqlUrl property for specifying path to graphiql UI default is '/graphiql'
Complete Example
Here's an example of a Feathers server that uses feathers-apollo-server
.
const feathers = ;const rest = ;const hooks = ;const bodyParser = ;const errorHandler = ;const plugin = ; const Opts=path:'/plugin'schemaresolvers //makeExecutable schema optionsconst extraOpts=context:key:"context_Value" // graphql server options: // Initialize the applicationconst app = // Needed for parsing bodies (login) // Initialize your feathers plugin ;app; console;
Todo
- Add server request object to graphql context
- Write more tests
- Improve readme documentation
License
Copyright (c) 2016
Licensed under the MIT license.