graphql vs graphql-yoga vs express-graphql vs apollo-server
GraphQL 서버 라이브러리
graphqlgraphql-yogaexpress-graphqlapollo-serverÄhnliche Pakete:

GraphQL 서버 라이브러리

GraphQL 서버 라이브러리는 GraphQL API를 구축하기 위한 도구로, 클라이언트가 필요한 데이터를 효율적으로 요청하고 받을 수 있도록 돕습니다. 이러한 라이브러리는 서버와 클라이언트 간의 데이터 통신을 최적화하고, 다양한 데이터 소스와의 통합을 용이하게 하며, 개발자가 API를 설계하고 구현하는 데 필요한 기능을 제공합니다.

npm-Download-Trend

3 Jahre

GitHub Stars Ranking

Statistik-Detail

Paket
Downloads
Stars
Größe
Issues
Veröffentlichung
Lizenz
graphql68,849,95120,3436.52 MB107vor 4 MonatenMIT
graphql-yoga2,676,5288,535364 kB143vor 11 TagenMIT
express-graphql437,2366,250-54vor 6 JahrenMIT
apollo-server177,68213,95826.6 kB89vor 3 JahrenMIT

Funktionsvergleich: graphql vs graphql-yoga vs express-graphql vs apollo-server

설정 용이성

  • graphql:

    GraphQL 자체는 API의 쿼리 언어로, 서버 설정을 위해서는 다른 라이브러리와 함께 사용해야 합니다. 설정 자체는 간단하지만, 서버를 구축하기 위해서는 추가적인 작업이 필요합니다.

  • graphql-yoga:

    GraphQL Yoga는 설정이 매우 간단하고, 기본적인 GraphQL 서버를 몇 줄의 코드로 설정할 수 있습니다. 초보자에게 적합한 옵션입니다.

  • express-graphql:

    Express-GraphQL은 Express.js의 미들웨어로 쉽게 통합할 수 있으며, 기본적인 GraphQL 서버를 빠르게 설정할 수 있습니다. 그러나 추가적인 설정이 필요할 수 있습니다.

  • apollo-server:

    Apollo Server는 설정이 간단하고, 다양한 데이터 소스와의 통합을 지원합니다. GraphQL 스키마를 쉽게 정의하고, 미들웨어를 통해 다양한 기능을 추가할 수 있습니다.

유연성

  • graphql:

    GraphQL은 API의 쿼리 언어로, 다양한 서버 구현에 유연하게 적용할 수 있습니다. 개발자가 원하는 방식으로 API를 설계할 수 있습니다.

  • graphql-yoga:

    GraphQL Yoga는 기본적인 설정 외에도 다양한 기능을 쉽게 추가할 수 있어, 유연한 서버 구성이 가능합니다.

  • express-graphql:

    Express-GraphQL은 Express.js의 유연성을 그대로 활용할 수 있어, 기존의 미들웨어와 함께 사용할 수 있습니다. 그러나 GraphQL의 모든 기능을 활용하기 위해서는 추가적인 설정이 필요합니다.

  • apollo-server:

    Apollo Server는 다양한 데이터 소스와의 통합을 지원하며, 복잡한 비즈니스 로직을 처리하는 데 유연성을 제공합니다. 또한, 다양한 플러그인을 통해 기능을 확장할 수 있습니다.

성능

  • graphql:

    GraphQL은 클라이언트가 필요한 데이터만 요청할 수 있도록 하여, 불필요한 데이터 전송을 줄이고 성능을 향상시킵니다.

  • graphql-yoga:

    GraphQL Yoga는 성능 최적화를 위해 기본적인 캐싱 기능을 제공하며, 빠른 응답 속도를 자랑합니다.

  • express-graphql:

    Express-GraphQL은 Express.js의 성능을 그대로 활용할 수 있으며, 미들웨어를 통해 성능 최적화를 도모할 수 있습니다. 그러나 복잡한 쿼리 처리 시 성능 저하가 발생할 수 있습니다.

  • apollo-server:

    Apollo Server는 캐싱 및 최적화를 통해 성능을 극대화할 수 있는 기능을 제공합니다. 또한, 데이터 로더를 사용하여 N+1 문제를 해결할 수 있습니다.

커뮤니티 및 지원

  • graphql:

    GraphQL은 페이스북에서 개발한 언어로, 전 세계적으로 많은 사용자가 있으며, 다양한 자료와 커뮤니티가 존재합니다.

  • graphql-yoga:

    GraphQL Yoga는 비교적 새로운 라이브러리지만, 사용하기 쉬운 문서와 커뮤니티 지원이 있어 초보자에게 적합합니다.

  • express-graphql:

    Express-GraphQL은 Express.js의 커뮤니티와 함께 지원을 받으며, 많은 자료와 예제가 존재합니다. 그러나 Apollo Server에 비해 상대적으로 지원이 적을 수 있습니다.

  • apollo-server:

    Apollo Server는 활발한 커뮤니티와 풍부한 문서화를 제공하여, 문제 해결 및 학습에 유리합니다. 다양한 튜토리얼과 예제가 있어 시작하기 쉽습니다.

확장성

  • graphql:

    GraphQL은 기본적으로 API의 쿼리 언어로, 다양한 서버 구현에 적용할 수 있어 확장성이 뛰어납니다.

  • graphql-yoga:

    GraphQL Yoga는 기본적인 설정 외에도 다양한 기능을 쉽게 추가할 수 있어, 확장성이 뛰어납니다.

  • express-graphql:

    Express-GraphQL은 Express.js의 확장성을 그대로 활용할 수 있어, 다양한 미들웨어와 함께 사용할 수 있습니다. 그러나 복잡한 기능을 추가하기 위해서는 추가적인 설정이 필요합니다.

  • apollo-server:

    Apollo Server는 다양한 플러그인과 미들웨어를 통해 기능을 쉽게 확장할 수 있어, 복잡한 애플리케이션에 적합합니다.

Wie man wählt: graphql vs graphql-yoga vs express-graphql vs apollo-server

  • graphql:

    GraphQL은 API의 쿼리 언어이자 런타임으로, 데이터 요청을 최적화하는 데 중점을 둡니다. GraphQL의 기본 기능을 활용하고 싶다면 이 패키지를 선택하세요.

  • graphql-yoga:

    GraphQL Yoga는 GraphQL 서버를 쉽게 설정할 수 있도록 돕는 라이브러리로, 빠른 시작과 유연성을 제공합니다. GraphQL을 처음 접하는 개발자에게 적합합니다.

  • express-graphql:

    Express-GraphQL은 Express.js와 통합되어 GraphQL API를 구축하는 데 적합합니다. 이미 Express.js를 사용하고 있다면 이 패키지를 선택하여 기존의 Express 미들웨어와 함께 사용할 수 있습니다.

  • apollo-server:

    Apollo Server는 GraphQL API를 쉽게 구축할 수 있도록 도와주는 강력한 도구입니다. 다양한 데이터 소스와의 통합이 필요하고, Apollo Client와의 호환성을 중시하는 경우 선택하세요.

README für graphql

GraphQL.js

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

npm version Build 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

With yarn:

yarn add graphql

With bun:

bun 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);
});

Want to ride the bleeding edge?

The npm branch in this repository is automatically maintained to be the last commit to 17.x.x 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

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. The exports map within the project package.json should direct runtimes and bundlers to the appropriate files. Tools that do not support exports will find the CommonJS and ESModule builds side by side, with the CommonJS code packaged in files with the .js extension and the ESModule build within .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.

Version Support

GraphQL.JS follows Semantic Versioning (SemVer) for its releases. Our version support policy is as follows:

  • Latest Major Version: We provide full support, including bug fixes and security updates, for the latest major version of GraphQL.JS.
  • Previous Major Version: We offer feature support for the previous major version for 12 months after the release of the newest major version. This means that for 12 months we can backport features for specification changes if they don't cause any breaking changes. We'll continue supporting the previous major version with bug and security fixes.
  • Older Versions: Versions older than the previous major release are considered unsupported. While the code remains available, we do not actively maintain or provide updates for these versions. One exception to this rule is when the older version has been released < 1 year ago, in that case we will treat it like the "Previous Major Version".

Long-Term Support (LTS)

We do not currently offer a Long-Term Support version of GraphQL.JS. Users are encouraged to upgrade to the latest stable version to receive the most up-to-date features, performance improvements, and security updates.

End-of-Life (EOL) Schedule

We will announce the EOL date for a major version at least 6 months in advance. After a version reaches its EOL, it will no longer receive updates, even for critical security issues.

Upgrade Assistance

To assist users in upgrading to newer versions:

  • We maintain detailed release notes for each version, highlighting new features, breaking changes, and deprecations.
  • Our documentation includes migration guides for moving between major versions.
  • The community forum (Discord channel #graphql-js) is available for users who need additional assistance with upgrades.

Security Updates

We prioritize the security of GraphQL.JS:

  • Critical security updates will be applied to both the current and previous major version.
  • For versions that have reached EOL, we strongly recommend upgrading to a supported version to receive security updates.

Community Contributions

We welcome community contributions for all versions of GraphQL.JS. However, our maintainers will primarily focus on reviewing and merging contributions for supported versions.