@apollo/federation
Apollo Federation Utilities
Last updated 5 years ago by apollo-bot .
MIT · Original npm
$ cnpm install @apollo/federation 
SYNC missed versions from official npm registry.

Apollo Federation 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 Federation API reference.

Usage

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

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: buildFederatedSchema([{ typeDefs, resolvers }])
});

Current Tags

  • 0.15.0-alpha.0                                ...           alpha (5 years ago)
  • 0.16.6                                ...           latest (5 years ago)
  • 0.16.1-alpha.0                                ...           next (5 years ago)

6 Versions

  • 0.16.2                                ...           5 years ago
  • 0.13.2                                ...           5 years ago
  • 0.16.1-alpha.0                                ...           5 years ago
  • 0.16.6                                ...           5 years ago
  • 0.15.0-alpha.0                                ...           5 years ago
  • 0.11.2                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org