0

I've been developing a site that uses Yoga Server, and Modules, and looking at using Shield for security.

However no matter what I seem to do, I can't get Shield to integrate with Yoga, and Modules.

Here is my code (note I have stripped parts out for ease of understanding):

index.ts

import { useGraphQLModules as GraphQLModules } from '@envelop/graphql-modules';
import { createYoga } from 'graphql-yoga';
import type { NextApiRequest, NextApiResponse } from 'next';
import application from './schema';

export default createYoga<{req: NextApiRequest; res: NextApiResponse;}>({
    plugins: [GraphQLModules(application)],`
});

schema.ts

import { createApplication } from 'graphql-modules';
import accounting from './accounting';
import users from './users';

const application = createApplication({
    modules: [
        accounting,
        users
    ],
});

export default application;

accounting.ts

import { createModule, gql } from 'graphql-modules';

export default createModule({
    id: 'accounting',
    dirname: __dirname,
    typeDefs: [
        gql`
            type Query {
                fees: [Fee]
            }
            type Fee {
                id: UUID!
                feeName: String
                dueDate: Date
                amount: Float
                description: String
                createdDateTime: DateTime
                emailSentDateTime: DateTime
            }
        `,
    ],
    resolvers: {
        Query: { ... }  
    },
});

My code all works fine, but I can't for the life of me get Shield to work when I use Modules...

0 Answers0