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!) { query ($city: String!) {
weather_getCityByName(name: $city config: {units: metric}) { weather_getCityByName(name: $city, config: { units: metric }) {
# remove the comments to add the coordinates to the query # remove the comments to add the coordinates to the query
# coordinates: coord { # coordinates: coord {
# lat # lat
# lon # lon
# } # }
country country
weather { weather {
temperature { temperature {
actual actual
feelsLike feelsLike
min min
max max
} }
summary { summary {
title title
description description
icon icon
} }
}
} }
}
} }

View File

@ -1,51 +1,52 @@
import { import {
Application, Application,
configureWunderGraphApplication, configureWunderGraphApplication,
cors, cors,
EnvironmentVariable, EnvironmentVariable,
introspect, introspect,
templates, templates,
} from '@wundergraph/sdk'; } from "@wundergraph/sdk";
import server from './wundergraph.server'; import server from "./wundergraph.server";
import operations from './wundergraph.operations'; import operations from "./wundergraph.operations";
const weather = introspect.graphql({ const weather = introspect.graphql({
apiNamespace: 'weather', apiNamespace: "weather",
url: 'https://graphql-weather-api.herokuapp.com/', url: "https://graphql-weather-api.herokuapp.com/",
}); });
const myApplication = new Application({ const myApplication = new Application({
name: 'app', name: "app",
apis: [ apis: [weather],
weather,
],
}); });
// configureWunderGraph emits the configuration // configureWunderGraph emits the configuration
configureWunderGraphApplication({ configureWunderGraphApplication({
application: myApplication, application: myApplication,
server, server,
operations, operations,
codeGenerators: [ codeGenerators: [
{ {
templates: [ templates: [
...templates.typescript.all, ...templates.typescript.all,
templates.typescript.operations, templates.typescript.operations,
templates.typescript.linkBuilder, 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,
}, },
],
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 { configureWunderGraphOperations } from "@wundergraph/sdk";
import type { OperationsConfiguration } from './generated/wundergraph.operations'; import type { OperationsConfiguration } from "./generated/wundergraph.operations";
export default configureWunderGraphOperations<OperationsConfiguration>({ export default configureWunderGraphOperations<OperationsConfiguration>({
operations: { operations: {
defaultConfig: { defaultConfig: {
authentication: { authentication: {
required: false, required: false,
}, },
}, },
queries: (config) => ({ queries: (config) => ({
...config, ...config,
caching: { caching: {
enable: false, enable: false,
staleWhileRevalidate: 60, staleWhileRevalidate: 60,
maxAge: 60, maxAge: 60,
public: true, public: true,
}, },
liveQuery: { liveQuery: {
enable: true, enable: true,
pollingIntervalSeconds: 1, pollingIntervalSeconds: 1,
}, },
}), }),
mutations: (config) => ({ mutations: (config) => ({
...config, ...config,
}), }),
subscriptions: (config) => ({ subscriptions: (config) => ({
...config, ...config,
}), }),
custom: {}, custom: {},
}, },
}); });