CLI commands
GraphQL Mesh v0 documentation (superseded by v1): Learn about GraphQL Mesh CLI commands, such as mesh dev, build, validate, start, and serve-source. Customize options with global flags.
Global Options
All commands can take two global optional options.
-r (alias: require) [array]
Loads specific require.extensions before running the codegen and reading the configuration.
--dir [string]
Used to modify the base directory for looking for a .meshrc config file.
List of Commands
mesh dev
Serves a GraphQL server with a GraphQL interface to test your Mesh API locally.
Can have an optional --port argument.
Options
--port [number]
The system port on which graphql-mesh will be made available.
This should be one of the normal system ports [1-65386] not currently used by any other service.
mesh build
Builds artifacts required to use mesh start for a gateway (production) server or SDK.
Can have --throwOnInvalidConfig to make CLI throw in case of an invalid configuration. By default,
CLI gives a warning and continues.
mesh validate
Validate the built artifacts (mesh build) required to use mesh start for a gateway (production)
server. The validation will check the following:
- presence of the
.mesh/folder - validation of the mesh configuration (see
packages/legacy/types/src/config-schema.json) - configured sources are valid
More information about this on the Mesh deployment page.
mesh start
Serves a GraphQL server using the built artifacts. mesh start compared to mesh dev does not rely
on the sources to build the schema. Instead, it uses the built artifacts. Therefore, mesh start is
recommended to start a mesh server in production.
More information about mesh start on the
Mesh deployment page.
Can have an optional --port argument.
Options
--port [number]
The system port on which graphql-mesh will be made available.
This should be one of the normal system ports [1-65386] not currently used by any other service.
mesh serve-source
serve-source helps with quickly assessing that Mesh properly ingests a source. Given a source name
as the only argument, Mesh will serve a GraphQL API only exposing the given source.
This command is handy to debug a source.
Example
Given the following configuration:
You can test that the “Weather” source is properly ingested by mesh by running:
Then, Mesh will serve a GraphQL API only exposing the “Weather” source.