@container-stack/graphql-schema
Container Stack Schema Module
Last updated 2 years ago by container-stack .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install @container-stack/graphql-schema 
SYNC missed versions from official npm registry.

@container-stack/graphql-schema

This package is intended to be used with Apollo Server to provide an easy way to setup a GraphQL server and connect it to your database. Note that Apollo Server is not a depenedency of this package.

Usage

Sample Schema exports four things: database, resolvers, subscriptions and typeDefs.

resolvers Resolvers are functions that tell the server how to find and return the data for each field in a GraphQL query. The resolving functions simply call your Database Connectors by passing in parameters and return the Connectors result (usually a Promise).

After creating your Database and Connectors from Database, you can call the resolvers function by passing in the Connectors and your public application settings (since settings are stored in the application state). Building on the previous examples:

typeDefs is a GraphQL Schema based on the queries provided to it from database. With the schema, you can do things like Find Posts by post_type, get the Postmeta of a Post by the post_id, and so on.

subscriptions GraphQL subscriptions allow developers to introduce new levels of interactivity to their apps with near-realtime updates. You can keep your app updated to the latest changes (that you subscribe to) between different users:

database The first part of Sample Schema is database. This class provides an easy connection to your database using some connection settings, explained below.

Files explained:

 src                         - directory is used for typescript code that is part of the project
    index.ts                 - Index file of the package. Consists of exported components and containers
    index.spec.ts            - Tests file for main
    modules                  - Fractal route for server-side application module splitting (schema definition, resolvers, subscription filters, database connectors )
 package.json                - file is used to describe the library and packages that are required added under peer-dependencies section
 tsconfig.json               - configuration file for the library compilation
 webpack.config.js           - configuration file of the compilation automation process for the library

Setup

modules directory consists of the sub directories based on the criteria for module splitting. Each sub-directory may have schema definition, resolvers, subscriptions, database

Schema definition files should have suffix as .graphql or .graphqls. Resolvers file should be named as resolvers.ts and subscriptions filter file as subscriptions.ts.

All the files under modules are automatically bundled when you run npm run build, so the above naming convention should be followed.

Reference:

https://github.com/ramsaylanier/WordExpressSchema

Current Tags

  • 0.0.9-20                                ...           latest (2 years ago)

43 Versions

  • 0.0.9-20                                ...           2 years ago
  • 0.0.9-19                                ...           2 years ago
  • 0.0.9-18                                ...           2 years ago
  • 0.0.9-17                                ...           2 years ago
  • 0.0.9-16                                ...           2 years ago
  • 0.0.9-14                                ...           2 years ago
  • 0.0.9-13                                ...           2 years ago
  • 0.0.9-11                                ...           2 years ago
  • 0.0.9-10                                ...           2 years ago
  • 0.0.9-9                                ...           2 years ago
  • 0.0.9-8                                ...           2 years ago
  • 0.0.9-6                                ...           2 years ago
  • 0.0.9-5                                ...           2 years ago
  • 0.0.9-4                                ...           2 years ago
  • 0.0.25                                ...           2 years ago
  • 0.0.24                                ...           2 years ago
  • 0.0.23                                ...           2 years ago
  • 0.0.21                                ...           2 years ago
  • 0.0.20                                ...           2 years ago
  • 0.0.18                                ...           2 years ago
  • 0.0.17                                ...           2 years ago
  • 0.0.14                                ...           2 years ago
  • 0.0.13                                ...           2 years ago
  • 0.0.12                                ...           2 years ago
  • 0.0.9-1                                ...           2 years ago
  • 0.0.8                                ...           2 years ago
  • 0.0.7                                ...           2 years ago
  • 0.0.6                                ...           2 years ago
  • 0.0.5-17                                ...           2 years ago
  • 0.0.5-16                                ...           2 years ago
  • 0.0.5-15                                ...           2 years ago
  • 0.0.5-14                                ...           2 years ago
  • 0.0.5-13                                ...           2 years ago
  • 0.0.5-12                                ...           2 years ago
  • 0.0.5-11                                ...           2 years ago
  • 0.0.5-10                                ...           2 years ago
  • 0.0.5-5                                ...           2 years ago
  • 0.0.5-4                                ...           2 years ago
  • 0.0.5-3                                ...           2 years ago
  • 0.0.5-2                                ...           2 years ago
  • 0.0.5-1                                ...           2 years ago
  • 0.0.5-0                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 44
This Month 46
Last Day 0
Last Week 0
Last Month 43
Dev Dependencies (5)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |