1.0.0 • Published 10 months ago

nova-graphql v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
10 months ago

Nova GraphQL server

Nova's public graphql server https://graph.nova.is

Playground Available

This Project is an API gateway and a data transformation layer for all of Nova's public data. This schema should represent all data available to nova clients such as nova-www, portal-www and nova-app. We try to include as little business logic as possible in this project. Seriously think about implementing logic in the connected server rather that in this project.

The graphql server can validate access tokens from Nova Identity Server and pass on to the connected server Authorization does not belong here though.

Installation

List of environment variables required for development available internally on noogle. (Nova dev team will provide if you don't have access to the intranet)

yarn

Development

yarn dev
# playground available on http://localhost:5000/graphql

CI

If you are getting an error in the "Check for changes" step, make sure to run yarn lint to format all the files locally and fix the issues. That will run eslint and prettier under the hood.

Committing

Before committing your changes is it recommended to run the auto-format command, that uses prettier under the hood.

yarn format

Apollo server

This project uses Apollo server - we recommend that you read the documentation to become familiar with the main concepts.

Caching

This project is configured to cache full responses as documented here. We use redis via the apollo-server-cache-redis as described here.

Default cache on all responses is set. That is to ensure that all responses for remote schemas such as Contentful and shopify are cached.

To override default cache for resources that are updated you can use the cache control directive and set cache control to 0. Example:

type MyType @cacheControl(maxAge: 0) {
  ...
}

Caching and schema stitching currently doesn't go well together and therefore we do some hacks. To override default cache on fields on remote schemas we have to define custom resolvers and add use the info.cacheControl.setCacheHint api.