mossman1120
mossman1120
PPrisma
Created by mossman1120 on 4/25/2025 in #help-and-questions
ExpressJs Transactions
Is there a best practices or best way to wrap all requests to an ExpressJS API server in a transaction. I would like to start a transaction for any request going to /api and then either commit on successfully return or rollback if an error occurs. If possible I would like this to be as transparent as possible. Is such a thing possible? Thanks!
2 replies
PPrisma
Created by mossman1120 on 4/25/2025 in #help-and-questions
Generating Prisma Client
I am trying to better understand how to correctly import the client from https://www.prisma.io/docs/orm/prisma-client/setup-and-configuration/generating-prisma-client I have used the new configuration:
generator client {
provider = "prisma-client-js"
output = "app/generated/prisma/client"
}
generator client {
provider = "prisma-client-js"
output = "app/generated/prisma/client"
}
and see that to use the client I should import as follows:
import { PrismaClient } from 'app/generated/prisma/client'
const prisma = new PrismaClient()
import { PrismaClient } from 'app/generated/prisma/client'
const prisma = new PrismaClient()
Below this I then see a section about @prisma/client? Should this be ignored if using the new way? Thanks!
2 replies