Skip to content

Using with other resolvers #48

Description

@zakayothuku
import {Prisma} from './generated/prisma-client'
import {resolvers} from './resolvers'
import {ApolloServer} from "apollo-server";
import {importSchema} from "graphql-import";
import {GraphqlAuthenticationPrismaAdapter} from "graphql-authentication-prisma";
import {mailer} from "./utils";

const db = new Prisma({
    endpoint: process.env.PRISMA_ENDPOINT!,
    secret: process.env.PRISMA_SECRET!,
    debug: true,
});

const graphqlAuthentication = graphqlAuthenticationConfig({
    adapter: new GraphqlAuthenticationPrismaAdapter(),
    secret: process.env.PRISMA_SECRET!,
    requiredConfirmedEmailForLogin: true,
    mailer,
    mailAppUrl: 'http://example.com'
});

const server = new ApolloServer({
    typeDefs: importSchema('./src/schema.graphql'),
    resolvers,
    introspection: true,
    playground: process.env.NODE_ENV === 'development',
    debug: process.env.NODE_ENV === 'development',
    context: req => ({...req, db, graphqlAuthentication}),
});

server.listen({port: process.env.PORT || 4000}).then(({url}) => {
    console.log(`🚀  Server ready at ${url}`);
});

How do I use the authQueries, authMutations resolvers with my other resolvers generated by graphql-resolver-codegen?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions