Skip to content

A base framework for setting up Apollo Server with codegen from schema to provide a graphql api

Notifications You must be signed in to change notification settings

lancegliser/node-express-apollo-graphql

Repository files navigation

Apollo server Express GraphQL API example

Provides a working API to expand from for initial development

Upstream v1.2.0

git remote add upstream [email protected]:lancegliser/node-express-apollo-graphql.git

GraphQL Playground

Once server is running (npm run-script dev:watch) You may load and interact with data through the playground.

Code generation and work flow

This API works from a GraphQL first approach. Each component you wish to write starts with a .graphql file. The types in it will cause typescript code to be generated by running the following command:

npm run graphql-codegen

The generated classes are created at:

src/generated/types.ts

You can import those types in your own resolver, providing you strong contracts and stub implementations.

Testing

Integration tests are run using Jest to create an instance of the API on a random port using Node. Testing supplies its own user context.

Jest can use a local .env file for process environment variables.

About

A base framework for setting up Apollo Server with codegen from schema to provide a graphql api

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages