0.3.1 • Published 3 years ago

apollostudio-subgraph-publish v0.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

apollostudio-subgraph-publish

Utility for programatically publishing subgraphs to Apollo Studio on service start.

Install

npm add apollostudio-subgraph-publish

Usage

import { publish } from 'apollostudio-subgraph-publish'

const schema = `
  extend type Query {
    me: User
  }

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

const typeDefs = gql(schema)
const server = new ApolloServer({ typeDefs, resolvers })

async main() {
  await publish({
    graph: 'example-lyd9e@current',
    subgraph: 'users',
    schema,
    credential: { api_key: process.env.APOLLO_KEY! },
    routing_url: 'http://users.svc.cluster.local:4001/graphql',
  })

  const { url } = await server.listen()
  console.log(`🚀  Server ready at ${url}`)
}

main()
0.3.1-next.1

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.2.0-next.1

3 years ago

0.1.0

3 years ago

0.0.0-dripip

3 years ago