wundergraph.config.ts
#
Overviewwundergraph.config.ts
is the main file to configure your WunderGraph applications.
If you init a project with wunderctl, using the defaults, it's usually located in the forlder .wundergraph
inside your project root.
You're able to introspect and combine APIs to compose them as a WunderGraph application. You can select one or more templates to generate clients for an application.
#
Introspection#
GraphQLIn case you have an existing service which implements the GraphQL specification, use the following approach:
This code makes an introspection requests to the service and generates an API object from it.
#
GraphQL FederationThis code assumes that the four services implement the GraphQL Federation specification. The WunderGraph sdk will introspect them with an introspection Query and combines them into a federated GraphQL API object.
#
OpenAPISpecificationWunderGraph also supports REST APIs, which get translated to GraphQL automatically. Here's one possible way of adding an OpenAPI based API to WunderGraph:
#
Creating an ApplicationUse one or more APIs and combine them inta an application.
#
Configure your WunderGraphThe function configureWunderGraph
allows you to put all the pieces together and generate the configuration of your WunderGraph. By default, the config is written to wundergraph.config.json
.
#
Running the Code-GeneratorIf you created wundergraph.config.ts
using wunderctl init
you should also find a package.json
in the same folder. All you have to do is run the development script:
Once this script is running, it will pick up changes to your config or the user defined Operations and continuously updates the wundergraph.config.json
as well as re-generates the code if code generators are defined.