Socket
Socket
Sign inDemoInstall

fastify-prisma-client

Package Overview
Dependencies
2
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-prisma-client

Prisma Plugin for Fastify


Version published
Maintainers
1
Weekly downloads
367
increased by10.88%

Weekly downloads

Readme

Source

fastify-prisma-client

Version

easy access to prisma client

Warning !

This package is for ease of access only so you must install prisma.

Installation

yarn add prisma fastify-prisma-client
or
npm install prisma fastify-prisma-client

Do not forget prisma generate ❗

yarn prisma generate
or
npx prisma generate

Usage

Register plugin

import fastifyPrismaClient from "fastify-prisma-client";

fastify.register(fastifyPrismaClient);

If you use with TypeScript , you have to give this type to avoid error

import Fastify, { FastifyInstance } from "fastify";

const fastify: FastifyInstance = Fastify();

Prisma client options are available and you can edit them

fastify.register(fastifyPrismaClient, {});

Use with fastify decorate

fastify.get("/users", async (request, reply) => {
  const users = await fastify.prisma.users.findMany();
  return { users };
});

Use with request decorate

fastify.get("/users", async (request, reply) => {
  const users = await request.prisma.users.findMany();
  return { users };
});

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Keywords

FAQs

Last updated on 07 Aug 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc