First commit
This commit is contained in:
20
api/src/functions/graphql.js
Normal file
20
api/src/functions/graphql.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import {
|
||||
createGraphQLHandler,
|
||||
makeMergedSchema,
|
||||
makeServices,
|
||||
} from '@redwoodjs/api'
|
||||
|
||||
import schemas from 'src/graphql/**/*.{js,ts}'
|
||||
import services from 'src/services/**/*.{js,ts}'
|
||||
import { db } from 'src/lib/db'
|
||||
|
||||
export const handler = createGraphQLHandler({
|
||||
schema: makeMergedSchema({
|
||||
schemas,
|
||||
services: makeServices({ services }),
|
||||
}),
|
||||
onException: () => {
|
||||
// Disconnect from your database with an unhandled exception.
|
||||
db.$disconnect()
|
||||
},
|
||||
})
|
||||
0
api/src/graphql/.keep
Normal file
0
api/src/graphql/.keep
Normal file
6
api/src/lib/db.js
Normal file
6
api/src/lib/db.js
Normal file
@@ -0,0 +1,6 @@
|
||||
// See https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/constructor
|
||||
// for options.
|
||||
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
|
||||
export const db = new PrismaClient()
|
||||
0
api/src/services/.keep
Normal file
0
api/src/services/.keep
Normal file
Reference in New Issue
Block a user