feat: init
This commit is contained in:
19
.wundergraph/.graphqlconfig
Normal file
19
.wundergraph/.graphqlconfig
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"projects": {
|
||||
"app": {
|
||||
"name": "app",
|
||||
"schemaPath": "generated/wundergraph.app.schema.graphql",
|
||||
"extensions": {
|
||||
"endpoints": {
|
||||
"app": {
|
||||
"introspect": false,
|
||||
"url": "http://localhost:9991/app/main/graphql",
|
||||
"headers": {
|
||||
"user-agent": "WunderGraph Client"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
8
.wundergraph/operations/Starters.graphql
Normal file
8
.wundergraph/operations/Starters.graphql
Normal file
@@ -0,0 +1,8 @@
|
||||
query Starters {
|
||||
pokemon_pokemons(limit: 12) {
|
||||
results {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
51
.wundergraph/wundergraph.config.ts
Executable file
51
.wundergraph/wundergraph.config.ts
Executable file
@@ -0,0 +1,51 @@
|
||||
import {
|
||||
Application,
|
||||
configureWunderGraphApplication,
|
||||
cors,
|
||||
EnvironmentVariable,
|
||||
introspect,
|
||||
templates,
|
||||
} from '@wundergraph/sdk';
|
||||
import server from './wundergraph.server';
|
||||
import operations from './wundergraph.operations';
|
||||
|
||||
const pokemonAPI = introspect.graphql({
|
||||
apiNamespace: 'pokemon',
|
||||
url: 'https://graphql-pokeapi.graphcdn.app/',
|
||||
});
|
||||
|
||||
const myApplication = new Application({
|
||||
name: 'app',
|
||||
apis: [
|
||||
pokemonAPI,
|
||||
],
|
||||
});
|
||||
|
||||
// configureWunderGraph emits the configuration
|
||||
configureWunderGraphApplication({
|
||||
application: myApplication,
|
||||
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,
|
||||
},
|
||||
});
|
32
.wundergraph/wundergraph.operations.ts
Executable file
32
.wundergraph/wundergraph.operations.ts
Executable file
@@ -0,0 +1,32 @@
|
||||
import { configureWunderGraphOperations } from '@wundergraph/sdk';
|
||||
import type { OperationsConfiguration } from './generated/wundergraph.operations';
|
||||
|
||||
export default configureWunderGraphOperations<OperationsConfiguration>({
|
||||
operations: {
|
||||
defaultConfig: {
|
||||
authentication: {
|
||||
required: false,
|
||||
},
|
||||
},
|
||||
queries: (config) => ({
|
||||
...config,
|
||||
caching: {
|
||||
enable: false,
|
||||
staleWhileRevalidate: 60,
|
||||
maxAge: 60,
|
||||
public: true,
|
||||
},
|
||||
liveQuery: {
|
||||
enable: true,
|
||||
pollingIntervalSeconds: 1,
|
||||
},
|
||||
}),
|
||||
mutations: (config) => ({
|
||||
...config,
|
||||
}),
|
||||
subscriptions: (config) => ({
|
||||
...config,
|
||||
}),
|
||||
custom: {},
|
||||
},
|
||||
});
|
11
.wundergraph/wundergraph.server.ts
Executable file
11
.wundergraph/wundergraph.server.ts
Executable file
@@ -0,0 +1,11 @@
|
||||
import {configureWunderGraphServer} from '@wundergraph/sdk';
|
||||
import type {HooksConfig} from './generated/wundergraph.hooks';
|
||||
import type {InternalClient} from './generated/wundergraph.internal.client';
|
||||
|
||||
export default configureWunderGraphServer<HooksConfig, InternalClient>(() => ({
|
||||
hooks: {
|
||||
queries: {},
|
||||
mutations: {},
|
||||
},
|
||||
graphqlServers: []
|
||||
}));
|
Reference in New Issue
Block a user