Mock any GraphQL schema. All you need is a schema.json
or the URL of a GraphQL server that has introspection enabled.
Steps:
- Update the schema to the one you want by either:
- Replacing
schema.json
, or - Replacing
https://api.spacex.land/graphql
inpackage.json
and runningnpm run update-schema
- Replacing
- Running
npm start
- Opening localhost:4000 and querying with Playground
Mocking docs: https://www.apollographql.com/docs/apollo-server/testing/mocking/