fix formatting

This commit is contained in:
Nithin Kumar B 2022-11-03 14:24:01 +05:30
parent e1668cb6cd
commit 8e6bd94510
3 changed files with 89 additions and 88 deletions

View File

@ -1,23 +1,23 @@
query ($city: String!) {
weather_getCityByName(name: $city config: {units: metric}) {
# remove the comments to add the coordinates to the query
# coordinates: coord {
# lat
# lon
# }
country
weather {
temperature {
actual
feelsLike
min
max
}
summary {
title
description
icon
}
}
weather_getCityByName(name: $city, config: { units: metric }) {
# remove the comments to add the coordinates to the query
# coordinates: coord {
# lat
# lon
# }
country
weather {
temperature {
actual
feelsLike
min
max
}
summary {
title
description
icon
}
}
}
}

View File

@ -1,51 +1,52 @@
import {
Application,
configureWunderGraphApplication,
cors,
EnvironmentVariable,
introspect,
templates,
} from '@wundergraph/sdk';
import server from './wundergraph.server';
import operations from './wundergraph.operations';
Application,
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/',
apiNamespace: "weather",
url: "https://graphql-weather-api.herokuapp.com/",
});
const myApplication = new Application({
name: 'app',
apis: [
weather,
],
name: "app",
apis: [weather],
});
// 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,
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,
},
});

View File

@ -1,32 +1,32 @@
import { configureWunderGraphOperations } from '@wundergraph/sdk';
import type { OperationsConfiguration } from './generated/wundergraph.operations';
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: {},
},
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: {},
},
});