Skip to content

Instantly share code, notes, and snippets.

@Romakita
Last active May 24, 2021 15:39
Show Gist options
  • Save Romakita/03951ebfab709cab3f6216fdf5747afb to your computer and use it in GitHub Desktop.
Save Romakita/03951ebfab709cab3f6216fdf5747afb to your computer and use it in GitHub Desktop.
Prisma
import { Injectable, OnInit, OnDestroy } from "@tsed/common";
import { PrismaClient } from "@prisma/client";
@Injectable()
export class PrismaService extends PrismaClient implements OnInit, OnDestroy {
async $onInit() {
await this.$connect();
}
async $onDestroy() {
await this.$disconnect();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment