apollo-starter
v1.0.4
Published
Create a GraphQL subgraph that loads typeDefs, resolvers and dataSources from a given path.
Downloads
1
Maintainers
Readme
Apollo GraphQL Starter
A library that starts an Apollo Subgraph which attempts to load typeDefs
, resolvers
and
dataSources
from the homonymous subdirectories in a path provided as a parameter.
The subgraph will also try to load environment variables and integrate to Sentry. For this it uses the Apollo Sentry Plugin.
Why?
Because if you're going to create several Apollo Subgraph projects, it simplifies things when you known they're all created equal. Meaning that for each subgraph you only have to worry about the actual types, resolvers and data sources, while you can rest easy that they all work the same way, evolve based on the same shared code and are instrumented with the same integrations.
Usage
index.js
import { startApolloSubgraphFromPath } from 'apollo-starter'
const serverPromise = startApolloSubgraphFromPath({
title: 'My Subgraph',
port: 4000,
relPath: './path/to/'
})
Will expect to load the subgraph's typeDefs
, resolvers
and
dataSources
from the following structure.
├── index.js
└── path
└──to
├── dataSources
│ └── ...
├── resolvers
│ └── ...
└── typeDefs
└── ...