Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using with other resolvers #48

Open
zakayothuku opened this issue Mar 30, 2019 · 0 comments
Open

Using with other resolvers #48

zakayothuku opened this issue Mar 30, 2019 · 0 comments

Comments

@zakayothuku
Copy link

zakayothuku commented Mar 30, 2019

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant