Manthan Mallikarjun
07/18/2020, 7:38 PMprisma to that folderRichard Ward
07/19/2020, 10:39 AMimport { PrismaClient } from "@prisma/client"; ?
(I'm using prisma2 but prisma1 was similar)Ryan
07/20/2020, 6:14 AM@prisma/client from anywhere as mentioned above by Richard.Manthan Mallikarjun
07/21/2020, 4:00 AMManthan Mallikarjun
07/21/2020, 4:00 AMManthan Mallikarjun
07/21/2020, 4:00 AMManthan Mallikarjun
07/21/2020, 4:01 AMManthan Mallikarjun
07/21/2020, 4:01 AMconst prisma = new PrismaClient({});
You need to use this instance of prisma throughout your app right?Ryan
07/21/2020, 6:41 AMconst prisma = new PrismaClient({
log: ['query'],
})Richard Ward
07/21/2020, 8:57 AMserver.ts I have something along the lines of the following:
const prisma = new PrismaClient({
errorFormat: 'minimal',
log: ['query']
});
const server = new ApolloServer({
typeDefs,
resolvers,
context: ({ req, res }: { req: any, res: any }): ApiContext => {
return { prisma, user: req.user, req, res };
},
});Richard Ward
07/21/2020, 8:58 AMreq object and then have access to it in your endpoint.Manthan Mallikarjun
07/22/2020, 3:36 AMimport Prisma from "../../../../prisma" you can do import prisma from 'prisma'Manthan Mallikarjun
07/22/2020, 3:36 AMManthan Mallikarjun
07/22/2020, 3:37 AM