FeathersQL
⚡️ The Feathers and GraphQL Integration.
Getting Started
You can create a project using feathers-cli. See more details here: https://github.com/feathersjs/cli
Usage Example Projects
With Common JS
https://github.com/hookcompany/feathersql/tree/master/example
With Import/Export and Babel Configuration
https://github.com/hookcompany/feathers-graphql-boilerplate
Installing
Install with npm
$ npm install --save feathersql
Install with Yarn
$ yarn add feathersql
Usage
// services/app1/users/types.gqlconst gql = ; moduleexports = gql` input UserFilter { id: Any name: Any birth: Any tags: Any createdAt: Any updatedAt: Any } input NewUserData { name: String! birth: Date! tags: [String] } input EditUserData { name: String birth: Date tags: [String] } input UserUpdateData { set: EditUserData push: [Any!] pull: [Any!] } type UserQuery @query { users(query: UserFilter, sort: Any, limit: Int, skip: Int): [User] @find user(id: ID, query: UserFilter): User @get } type UserMutation @mutation { createUser(data: NewUserData!): User @create createUsers(data: [NewUserData!]!, sort: Any): [User] @create updateUser(id: ID, query: UserFilter, data: UserUpdateData!): User @update updateUsers(id: ID, query: UserFilter, data: UserUpdateData!, sort: Any): [User] @update patchUser(id: ID, query: UserFilter, data: EditUserData!): User @patch patchUsers(id: ID, query: UserFilter, data: EditUserData!, sort: Any): [User] @patch removeUser(id: ID, query: UserFilter): User @remove removeUsers(id: ID, query: UserFilter, sort: Any): [User] @remove } type UserSubscription @subscription { createUser: [User] @create updateUser: [User] @update patchUser: [User] @patch removeUser: [User] @remove }`;
// services/app1/users/index.jsconst types = ;const hooks = ; moduleexports = types hooks modelName: 'User' path: '/users' filters: { console; return true; } { console; return true; } { console; return true; } ;
// services/app1/index.jsconst Category = ;const Product = ;const User = ; moduleexports = basePath: '/app1' services: User Category Product;
// services/index.jsconst feathersQL = ;const models = ;const app1 = ;const app2 = ; module { app platformapp1 platformapp2 ;};
Configuration
const mongoose = ; module { mongoose; mongoosePromise = globalPromise; app; // This line is mandatory.};
Querying
Support
Query
eq
gt && gte
lt && lte
in
ne && nen
exists && not
mod
regex
options
size
Sort
sort: ["name:desc", "createdAt:asc"]
sort: "name:desc createdAt:asc"
sort: { name: "desc", createdAt: "asc" }
Limit: Int
Skip: Int
Options
mongooseClientVariableName
(String) - Mongoose client variable name. ex.:app.set('mongooseClient', mongoose);
; default is 'mongooseClient'socketPort
(Int) - Subscriptions socket port; default is 5000graphqlEndPoint
(String) - GraphQL endpoint; default is '/graphql'subscriptionEndPoint
(String) - Subscriptions endpoint; default is '/subscriptions'voyagerEndPoint
(String) - Voyager endpoint; default is '/voyager'graphiqlEndPoint
(String) - GraphQL IDE endpoint; default is '/graphiql'playgroundEndPoint
(String) - Playground(similar to GraphQL IDE) endpoint; default is '/playground'subscription
(Bool) - Configure subscriptions; default is truevoyager
(Bool) - Configure voyager; default is truegraphiql
(Bool) - Configure GraphQL IDE; default is trueplayground
(Bool) - Configure playground; default is true
Consuming The API
Populate
Subscriptions
License
This project is licensed under the MIT License - see the LICENSE.md file for details.