Hey! I have a question about implementing middlewa...
# orm-help
b
Hey! I have a question about implementing middleware in a NextJS app. I’m using this approach to include Prisma in the app:
Copy code
import { PrismaClient } from '@prisma/client';

// add prisma to the NodeJS global type
interface CustomNodeJsGlobal extends NodeJS.Global {
  prisma: PrismaClient;
}

// Prevent multiple instances of Prisma Client in development
declare const global: CustomNodeJsGlobal;

const prisma = global.prisma || new PrismaClient();

if (process.env.NODE_ENV === 'development') global.prisma = prisma;

export default prisma;
Is there any best practice way of including a Prisma middleware in a NextJS app? The docs only mentions an express app.
b
Cheers!