File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 11import NextAuth from "next-auth" ;
22import GithubProvider from "next-auth/providers/github" ;
33import { PrismaAdapter } from "@next-auth/prisma-adapter" ;
4- import { PrismaClient } from "@prisma/client" ;
5-
6- const prisma = new PrismaClient ( ) ;
4+ import client from "@/prisma-client" ;
75
86export default NextAuth ( {
9- adapter : PrismaAdapter ( prisma ) ,
7+ adapter : PrismaAdapter ( client ) ,
108 providers : [
119 GithubProvider ( {
1210 clientId : process . env . GITHUB_ID ,
Original file line number Diff line number Diff line change 1- import { PrismaClient } from "@prisma/client" ;
21import type { NextApiHandler } from "next" ;
3-
4- const prisma = new PrismaClient ( ) ;
2+ import client from "@/prisma-client" ;
53
64const handler : NextApiHandler = async ( req , res ) => {
75 if ( req . method === "GET" ) {
8- const posts = prisma . post . findMany ( ) ;
6+ const posts = client . post . findMany ( ) ;
97 res . status ( 200 ) . json ( { status : "success" , data : posts } ) ;
108 } else if ( req . method === "POST" ) {
119 } else {
Original file line number Diff line number Diff line change 1+ import { PrismaClient } from "@prisma/client" ;
2+
3+ const client = new PrismaClient ( ) ;
4+
5+ export default client ;
You can’t perform that action at this time.
0 commit comments