wundergraph.config.ts reference

Configuration of WunderGraph is done in wundergraph.config.ts using configureWunderGraphApplication.

Example configuration:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// wundergraph.config.ts
import { configureWunderGraphApplication, cors, EnvironmentVariable, introspect, templates } from '@wundergraph/sdk';
import server from './wundergraph.server';
import operations from './wundergraph.operations';
const countries = introspect.graphql({
apiNamespace: 'countries',
url: 'https://countries.trevorblades.com/',
});
// configureWunderGraph emits the configuration
configureWunderGraphApplication({
apis: [countries],
server,
operations,
codeGenerators: [
{
templates: [
// use all the typescript react templates to generate a client
...templates.typescript.all,
],
},
],
cors: {
...cors.allowAll,
allowedOrigins:
process.env.NODE_ENV === 'production'
? [
// change this before deploying to production to the actual domain where you're deploying your app
'http://localhost:3000',
]
: ['http://localhost:3000', new EnvironmentVariable('WG_ALLOWED_ORIGIN')],
},
security: {
enableGraphQLEndpoint: process.env.NODE_ENV !== 'production' || process.env.GITPOD_WORKSPACE_ID !== undefined,
},
});

Supported properties

ParameterDescription
apisAn array of data sources.
optionsWunderNode Options.
serverWunderGraph hooks server configuration.
operationsWunderGraph operations configuration.
codeGeneratorsCode generators.
s3UploadProviderUploads configuration.
corsCORS configuration.
authorizationAuthorization configuration.
authenticationConfigure cookie and token based authentication.
linksLink builder configuration.
securitySecurity configuration.
Previous
Overview

Was this article helpful to you?
Provide feedback

Edit this page