2.0.1 • Published 3 years ago
@lamware/prisma v2.0.1
This Lamware Middleware allows you to initialize and memoize your Prisma Client.
Installation
This package is available via NPM:
yarn add @lamware/prisma
# or
npm install @lamware/prismaUsage
import type { APIGatewayProxyHandlerV2 } from 'aws-lambda';
import { PrismaClient } from '@prisma/client';
import { prisma } from '@lamware/prisma';
import { lamware } from '@lamware/core';
const { handler } = lamware<APIGatewayProxyHandlerV2<any>>()
// You can provide your PrismaClient directly.
.use(prisma(PrismaClient))
// Or an (a)synchronous set-up closure.
.use(prisma(async () => {
return new PrismaClient();
}))
.execute(async ({ state }) => {
const user = await state.prisma.user.findUnique({
where: { id: 1 },
});
return { statusCode: 200 };
});
export { handler };1.4.2
3 years ago
2.0.1
3 years ago
2.0.0
3 years ago
1.4.1
3 years ago
1.4.0
3 years ago
1.3.1
3 years ago
1.3.0
3 years ago
1.2.25
3 years ago
1.2.24
3 years ago
1.2.23
4 years ago
1.2.22
4 years ago
1.2.21
4 years ago
1.2.20
4 years ago
1.2.19
4 years ago
1.2.18
4 years ago
1.2.17
4 years ago
1.2.16
4 years ago
1.2.15
4 years ago
1.2.14
4 years ago
1.2.13
4 years ago
1.2.12
4 years ago
1.2.11
4 years ago
1.2.10
4 years ago
1.2.9
4 years ago
1.2.8
4 years ago