File tree 10 files changed +22
-8
lines changed
10 files changed +22
-8
lines changed File renamed without changes.
Original file line number Diff line number Diff line change 9
9
"ios" : " expo start --ios" ,
10
10
"web" : " expo start --web" ,
11
11
"test" : " jest --watchAll" ,
12
- "vercel-build" : " expo export -p web"
12
+ "vercel-build" : " expo export -p web" ,
13
+ "postinstall" : " prisma generate"
13
14
},
14
15
"jest" : {
15
16
"preset" : " jest-expo"
Original file line number Diff line number Diff line change 1
1
import { ExpoResponse } from 'expo-router/server' ;
2
2
3
- import { prisma } from '@/server/db' ;
3
+ import prisma from '@/server/db' ;
4
4
5
5
export async function GET ( ) {
6
6
const categoryList = await prisma . category . findMany ( ) ;
Original file line number Diff line number Diff line change 1
1
import { ExpoRequest , ExpoResponse } from 'expo-router/server' ;
2
2
import { isEmpty } from 'lodash' ;
3
3
4
- import { prisma } from '@/server/db' ;
4
+ import prisma from '@/server/db' ;
5
5
6
6
export async function GET ( _request : ExpoRequest , { id } : { id : string } ) {
7
7
const listing = await prisma . listing . findUnique ( {
Original file line number Diff line number Diff line change 1
1
import { Listing } from '@prisma/client' ;
2
2
import { ExpoRequest , ExpoResponse } from 'expo-router/server' ;
3
3
4
- import { prisma } from '@/server/db' ;
4
+ import prisma from '@/server/db' ;
5
5
import getApiParams from '@/utils/getApiParams' ;
6
6
7
7
export async function GET ( request : ExpoRequest ) {
Original file line number Diff line number Diff line change 1
1
import { ExpoRequest , ExpoResponse } from 'expo-router/server' ;
2
2
3
- import { prisma } from '@/server/db' ;
3
+ import prisma from '@/server/db' ;
4
4
5
5
export async function GET ( _request : ExpoRequest , { id } : { id : string } ) {
6
6
const user = await prisma . user . findMany ( {
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import React from 'react';
3
3
import { Platform } from 'react-native' ;
4
4
const Spin = ( ) => {
5
5
if ( Platform . OS === 'web' ) {
6
- return < img src = " ../../../assets/images/web-spin.gif" /> ;
6
+ return < img src = { require ( ' ../../../assets/images/web-spin.gif' ) } /> ;
7
7
}
8
8
9
9
return (
Original file line number Diff line number Diff line change 1
1
import { PrismaClient } from '@prisma/client' ;
2
2
3
- export const prisma = new PrismaClient ( ) ;
3
+ const prismaClientSingleton = ( ) => {
4
+ return new PrismaClient ( ) ;
5
+ } ;
6
+
7
+ const globalThis = global as unknown as { prisma : PrismaClient } ;
8
+
9
+ const prisma = globalThis . prisma ?? prismaClientSingleton ( ) ;
10
+
11
+ if ( process . env . NODE_ENV !== 'production' ) globalThis . prisma = prisma ;
12
+
13
+ export default prisma ;
Original file line number Diff line number Diff line change 3
3
4
4
generator client {
5
5
provider = " prisma-client-js "
6
+ // binaryTargets = ["native", "rhel-openssl-1.0.x"]
6
7
}
7
8
8
9
datasource db {
Original file line number Diff line number Diff line change 1
1
import axios from 'axios' ;
2
2
3
+ const isDev = process . env . NODE_ENV === 'development' ;
4
+
3
5
const request = axios . create ( {
4
- baseURL : 'http://localhost:8081/api'
6
+ baseURL : isDev ? 'http://localhost:8081/api' : ' /api'
5
7
} ) ;
6
8
7
9
export default request ;
You can’t perform that action at this time.
0 commit comments