@apollo/subgraph
Apollo Subgraph Utilities
Last updated 4 years ago by apollo-bot .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @apollo/subgraph 
SYNC missed versions from official npm registry.

Apollo Subgraph Utilities

This package provides utilities for creating GraphQL microservices, which can be combined into a single endpoint through tools like Apollo Gateway.

For complete documentation, see the Apollo Subgraph API reference.

Usage

const { ApolloServer, gql } = require("apollo-server");
const { buildSubgraphSchema } = require("@apollo/subgraph");

const typeDefs = gql`
  type Query {
    me: User
  }

  type User @key(fields: "id") {
    id: ID!
    username: String
  }
`;

const resolvers = {
  Query: {
    me() {
      return { id: "1", username: "@ava" }
    }
  },
  User: {
    __resolveReference(user, { fetchUserById }){
      return fetchUserById(user.id)
    }
  }
};

const server = new ApolloServer({
  schema: buildSubgraphSchema([{ typeDefs, resolvers }])
});

Current Tags

  • 0.1.5                                ...           latest (4 years ago)
  • 2.0.0-alpha.3                                ...           latest-2 (4 years ago)

9 Versions

  • 2.0.0-alpha.3                                ...           4 years ago
  • 2.0.0-alpha.2                                ...           4 years ago
  • 0.1.5                                ...           4 years ago
  • 2.0.0-alpha.1                                ...           4 years ago
  • 2.0.0-alpha.0                                ...           4 years ago
  • 0.1.4                                ...           4 years ago
  • 0.1.2                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |