Skip to content

Commit a0604c9

Browse files
committed
enable queryCostPlugin for northwind example
1 parent 903fd4b commit a0604c9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

examples/northwind/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import dedent from 'dedent';
22
import schema from './schema';
3+
import { initQueryComplexityPlugin } from './queryCostPlugin';
34

45
export default {
56
uri: '/northwind',
67
schema: schema,
8+
plugins: [initQueryComplexityPlugin({ schema })],
79
title: 'Northwind: complex schema with 8 models',
810
description:
911
'This is a sample data of some trading company, which consists from 8 models. All models has cross-relations to each other. This schema used in <b><a href="https://nodkz.github.io/relay-northwind/" target="_blank">Relay example app <span class="glyphicon glyphicon-new-window"></span></a></b>',

examples/northwind/queryCostPlugin.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import { separateOperations, GraphQLSchema } from 'graphql';
99

1010
export function initQueryComplexityPlugin(opts: {
1111
schema: GraphQLSchema;
12-
maxComplexity: number;
12+
maxComplexity?: number;
1313
}): ApolloServerPlugin {
1414
return {
1515
requestDidStart: () => {
1616
let complexity = 0;
17-
const maxComplexity = opts.maxComplexity || 1000;
17+
const maxComplexity = opts.maxComplexity || 10000;
1818
return {
1919
didResolveOperation({ request, document }) {
2020
/**

0 commit comments

Comments
 (0)