Socket
Book a DemoInstallSign in
Socket

@icapps/nestjs-prisma

Package Overview
Dependencies
Maintainers
8
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@icapps/nestjs-prisma

Everything you need to get started with Prisma in NestJS

1.0.1
latest
Source
npmnpm
Version published
Maintainers
8
Created
Source

@icapps/nestjs-prisma

Everything you need to get started with Prisma in NestJS

Installation

Quick installation

npx @icapps/nestjs-prisma

Manual installation

1. Install @icapps/nestjs-prisma and Prisma Client

npm install @icapps/nestjs-prisma @prisma/client

2. Install Prisma CLI

npm install prisma --save-dev

3. Initialize Prisma

npx prisma init

Usage

1. Import PrismaModule into your root module

// app.module.ts

import { Module } from '@nestjs/common';
import { PrismaModule } from '@icapps/nestjs-prisma';

@Module({
  imports: [PrismaModule],
})
export class AppModule {}

2. Enable shutdown hooks

// main.ts

import { PrismaService } from '@icapps/nestjs-prisma';
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  const prismaService = await app.get(PrismaService);
  await prismaService.enableShutdownHooks(app);

  await app.listen(3000);
}
bootstrap();

3. Import PrismaService to get started

// todo.service.ts

import { PrismaService } from '@icapps/nestjs-prisma';
import { Injectable } from '@nestjs/common';

@Injectable()
export class TodoService {
  constructor(private prisma: PrismaService) {}

  findAll() {
    return this.prisma.todo.findMany();
  }
}

Keywords

nestjs

FAQs

Package last updated on 30 May 2023

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.