2.0.1 • Published 2 years ago

@lamware/prisma v2.0.1

Weekly downloads
-
License
GPL-3.0-only
Repository
github
Last release
2 years ago

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/prisma

Usage

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

2 years ago

2.0.1

2 years ago

2.0.0

2 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

3 years ago

1.2.22

3 years ago

1.2.21

3 years ago

1.2.20

3 years ago

1.2.19

3 years ago

1.2.18

3 years ago

1.2.17

3 years ago

1.2.16

3 years ago

1.2.15

3 years ago

1.2.14

3 years ago

1.2.13

3 years ago

1.2.12

3 years ago

1.2.11

3 years ago

1.2.10

3 years ago

1.2.9

3 years ago

1.2.8

3 years ago