wundergraph.andert.me/.wundergraph/wundergraph.config.ts
2022-11-21 23:14:08 +01:00

47 lines
1.1 KiB
TypeScript
Executable File

import {
configureWunderGraphApplication,
cors,
EnvironmentVariable,
introspect,
templates,
} from "@wundergraph/sdk";
import server from "./wundergraph.server";
import operations from "./wundergraph.operations";
const weather = introspect.graphql({
apiNamespace: "weather",
url: "https://graphql-weather-api.herokuapp.com/",
});
// configureWunderGraph emits the configuration
configureWunderGraphApplication({
apis: [weather],
server,
operations,
codeGenerators: [
{
templates: [
...templates.typescript.all,
templates.typescript.operations,
templates.typescript.linkBuilder,
],
},
],
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"),
],
},
dotGraphQLConfig: {
hasDotWunderGraphDirectory: false,
},
});