wundergraph.andert.me/.wundergraph/wundergraph.config.ts

34 lines
843 B
TypeScript
Raw Permalink Normal View History

2022-10-28 12:42:05 +00:00
import {
2022-11-03 08:54:01 +00:00
configureWunderGraphApplication,
cors,
EnvironmentVariable,
introspect,
} from "@wundergraph/sdk";
import server from "./wundergraph.server";
import operations from "./wundergraph.operations";
2022-10-28 12:42:05 +00:00
2022-12-02 11:24:48 +00:00
const spacex = introspect.graphql({
apiNamespace: "spacex",
2022-12-11 16:04:53 +00:00
url: 'https://spacex-api.fly.dev/graphql',
2022-10-28 12:42:05 +00:00
});
// configureWunderGraph emits the configuration
configureWunderGraphApplication({
2022-12-02 11:24:48 +00:00
apis: [spacex],
2022-11-03 08:54:01 +00:00
server,
operations,
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"),
],
2023-06-19 07:35:40 +00:00
}
2022-10-28 12:42:05 +00:00
});