All Projects → graphql → Graphql Js

graphql / Graphql Js

Licence: mit
A reference implementation of GraphQL for JavaScript

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
shell
77523 projects

Projects that are alternatives of or similar to Graphql Js

Graphql Scalars
A library of custom GraphQL Scalars for creating precise type-safe GraphQL schemas.
Stars: ✭ 1,023 (-94.39%)
Mutual labels:  graphql, graphql-js
The Road To Graphql Chinese
📓The Road to GraphQL: Your journey to master pragmatic GraphQL in JavaScript
Stars: ✭ 104 (-99.43%)
Mutual labels:  graphql, graphql-js
Graphql Rxjs
fork of Graphql which adds Observable support
Stars: ✭ 78 (-99.57%)
Mutual labels:  graphql, graphql-js
React App
Create React App with server-side code support
Stars: ✭ 614 (-96.64%)
Mutual labels:  graphql, graphql-js
Grial
A Node.js framework for creating GraphQL API servers easily and without a lot of boilerplate.
Stars: ✭ 194 (-98.94%)
Mutual labels:  graphql, graphql-js
Type Graphql
Create GraphQL schema and resolvers with TypeScript, using classes and decorators!
Stars: ✭ 6,864 (-62.39%)
Mutual labels:  graphql, graphql-js
Cruddl
Create a GraphQL API for your database, using the GraphQL SDL to model your schema.
Stars: ✭ 98 (-99.46%)
Mutual labels:  graphql, graphql-js
Graphql Tools
🔧 Build, mock, and stitch a GraphQL schema using the schema language
Stars: ✭ 4,556 (-75.04%)
Mutual labels:  graphql, graphql-js
Graphql2rest
GraphQL to REST converter: automatically generate a RESTful API from your existing GraphQL API
Stars: ✭ 181 (-99.01%)
Mutual labels:  graphql, graphql-js
Hangzhou Graphql Party
杭州 GraphQLParty 往期记录(slide,照片,预告,视频等)
Stars: ✭ 142 (-99.22%)
Mutual labels:  graphql, graphql-js
Graphql Cost Analysis
A Graphql query cost analyzer.
Stars: ✭ 527 (-97.11%)
Mutual labels:  graphql, graphql-js
The Road To Graphql
📓The Road to GraphQL: Your journey to master pragmatic GraphQL in JavaScript
Stars: ✭ 203 (-98.89%)
Mutual labels:  graphql, graphql-js
Graphql Iso Date
A set of RFC 3339 compliant date/time GraphQL scalar types.
Stars: ✭ 480 (-97.37%)
Mutual labels:  graphql, graphql-js
Aws Mobile Appsync Sdk Js
JavaScript library files for Offline, Sync, Sigv4. includes support for React Native
Stars: ✭ 806 (-95.58%)
Mutual labels:  graphql, graphql-js
Graphql Query Complexity
GraphQL query complexity analysis and validation for graphql-js
Stars: ✭ 424 (-97.68%)
Mutual labels:  graphql, graphql-js
Graphql Log
Add logging to your GraphQL resolvers so you know what's going on in your app.
Stars: ✭ 94 (-99.48%)
Mutual labels:  graphql, graphql-js
Graphql Core
A Python 3.6+ port of the GraphQL.js reference implementation of GraphQL.
Stars: ✭ 344 (-98.12%)
Mutual labels:  graphql, graphql-js
Typegql
Create GraphQL schema with TypeScript classes.
Stars: ✭ 415 (-97.73%)
Mutual labels:  graphql, graphql-js
Postgraphile
GraphQL is a new way of communicating with your server. It eliminates the problems of over- and under-fetching, incorporates strong data types, has built-in introspection, documentation and deprecation capabilities, and is implemented in many programming languages. This all leads to gloriously low-latency user experiences, better developer experiences, and much increased productivity. Because of all this, GraphQL is typically used as a replacement for (or companion to) RESTful API services.
Stars: ✭ 10,967 (-39.91%)
Mutual labels:  graphql, graphql-js
Join Monster
A GraphQL to SQL query execution layer for query planning and batch data fetching.
Stars: ✭ 2,395 (-86.88%)
Mutual labels:  graphql, graphql-js

GraphQL.js

The JavaScript reference implementation for GraphQL, a query language for APIs created by Facebook.

npm version Build Status Coverage Status

See more complete documentation at https://graphql.org/ and https://graphql.org/graphql-js/.

Looking for help? Find resources from the community.

Getting Started

A general overview of GraphQL is available in the README for the Specification for GraphQL. That overview describes a simple set of GraphQL examples that exist as tests in this repository. A good way to get started with this repository is to walk through that README and the corresponding tests in parallel.

Using GraphQL.js

Install GraphQL.js from npm

With npm:

npm install --save graphql

or using yarn:

yarn add graphql

GraphQL.js provides two important capabilities: building a type schema and serving queries against that type schema.

First, build a GraphQL type schema which maps to your codebase.

import {
  graphql,
  GraphQLSchema,
  GraphQLObjectType,
  GraphQLString,
} from 'graphql';

var schema = new GraphQLSchema({
  query: new GraphQLObjectType({
    name: 'RootQueryType',
    fields: {
      hello: {
        type: GraphQLString,
        resolve() {
          return 'world';
        },
      },
    },
  }),
});

This defines a simple schema, with one type and one field, that resolves to a fixed value. The resolve function can return a value, a promise, or an array of promises. A more complex example is included in the top-level tests directory.

Then, serve the result of a query against that type schema.

var source = '{ hello }';

graphql({ schema, source }).then((result) => {
  // Prints
  // {
  //   data: { hello: "world" }
  // }
  console.log(result);
});

This runs a query fetching the one field defined. The graphql function will first ensure the query is syntactically and semantically valid before executing it, reporting errors otherwise.

var source = '{ BoyHowdy }';

graphql({ schema, source }).then((result) => {
  // Prints
  // {
  //   errors: [
  //     { message: 'Cannot query field BoyHowdy on RootQueryType',
  //       locations: [ { line: 1, column: 3 } ] }
  //   ]
  // }
  console.log(result);
});

Note: Please don't forget to set NODE_ENV=production if you are running a production server. It will disable some checks that can be useful during development but will significantly improve performance.

Want to ride the bleeding edge?

The npm branch in this repository is automatically maintained to be the last commit to main to pass all tests, in the same form found on npm. It is recommended to use builds deployed to npm for many reasons, but if you want to use the latest not-yet-released version of graphql-js, you can do so by depending directly on this branch:

npm install graphql@git://github.com/graphql/graphql-js.git#npm

Experimental features

Each release of GraphQL.js will be accompanied by an experimental release containing support for the @defer and @stream directive proposal. We are hoping to get community feedback on these releases before the proposal is accepted into the GraphQL specification. You can use this experimental release of GraphQL.js by adding the following to your project's package.json file.

"graphql": "experimental-stream-defer"

Community feedback on this experimental release is much appreciated and can be provided on the issue created for this purpose.

Using in a Browser

GraphQL.js is a general-purpose library and can be used both in a Node server and in the browser. As an example, the GraphiQL tool is built with GraphQL.js!

Building a project using GraphQL.js with webpack or rollup should just work and only include the portions of the library you use. This works because GraphQL.js is distributed with both CommonJS (require()) and ESModule (import) files. Ensure that any custom build configurations look for .mjs files!

Contributing

We actively welcome pull requests. Learn how to contribute.

This repository is managed by EasyCLA. Project participants must sign the free (GraphQL Specification Membership agreement before making a contribution. You only need to do this one time, and it can be signed by individual contributors or their employers.

To initiate the signature process please open a PR against this repo. The EasyCLA bot will block the merge if we still need a membership agreement from you.

You can find detailed information here. If you have issues, please email [email protected].

If your company benefits from GraphQL and you would like to provide essential financial support for the systems and people that power our community, please also consider membership in the GraphQL Foundation.

Changelog

Changes are tracked as GitHub releases.

License

GraphQL.js is MIT-licensed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].