gqlmocks serve command is the fastest way to get mocking only a GraphQL Schema.
serve command provides:
- Running server at
- A graphiql ide for browsing the schema
- Automatic remote schema fetching with the
- Bundled falso middleware for automatic mocking with fake data
See the gqlmocks command documentation for more information and available flags.
Having a mock GraphQL Server available at
localhost is valuable for testing against other GraphQL tools and integrating with other locally running services.
The provided the
/client path available on the server provides a fully running GraphiQL IDE.
Fast Mocking with Remote Schema and Falso
The fastest way to mocking a GraphQL API without any setup is to use the Falso middleware and specifying a remote url to a GraphQL Schema file or remote GraphQL API. The Falso middleware will handle
--header flags can be used to specify any headers required to fetch the remote schema.
serve with a Local Handler or Config
If a more refined mocking is setup locally the
gqlmocks serve command will look for a local project config file to serve. Additionally a specific handler or config file can be served with the
--config flags respectively.