File tree 5 files changed +25
-6
lines changed
5 files changed +25
-6
lines changed Original file line number Diff line number Diff line change 1
1
import { NextResponse } from 'next/server'
2
- import { PrismaClient } from '@prisma/client '
2
+ import { prisma } from '@/lib/prisma '
3
3
import { cookies } from 'next/headers'
4
4
5
- const prisma = new PrismaClient ( )
5
+
6
6
7
7
export async function POST ( request : Request ) {
8
8
const { username, password } = await request . json ( )
Original file line number Diff line number Diff line change
1
+ import { PrismaClient } from '@prisma/client'
2
+
3
+ const globalForPrisma = global as unknown as {
4
+ prisma : PrismaClient | undefined
5
+ }
6
+
7
+ export const prisma =
8
+ globalForPrisma . prisma ??
9
+ new PrismaClient ( {
10
+ log : [ 'query' ] ,
11
+ } )
12
+
13
+ if ( process . env . NODE_ENV !== 'production' ) globalForPrisma . prisma = prisma
Original file line number Diff line number Diff line change 1
1
/** @type {import('next').NextConfig } */
2
- const nextConfig = { } ;
3
-
4
- export default nextConfig ;
2
+ const nextConfig = {
3
+ experimental : {
4
+ serverComponentsExternalPackages : [ '@prisma/client' ] ,
5
+ } ,
6
+ } ;
7
+
8
+ export default nextConfig ;
Original file line number Diff line number Diff line change 6
6
"dev" : " next dev" ,
7
7
"build" : " next build" ,
8
8
"start" : " next start" ,
9
- "lint" : " next lint"
9
+ "lint" : " next lint" ,
10
+ "vercel-build" : " prisma generate && next build"
10
11
},
11
12
"prisma" : {
12
13
"seed" : " ts-node prisma/seed.ts"
Original file line number Diff line number Diff line change 17
17
"name" : " next"
18
18
}
19
19
],
20
+ "baseUrl" : " ." ,
20
21
"paths" : {
21
22
"@/*" : [" ./*" ]
22
23
}
You can’t perform that action at this time.
0 commit comments