Hello World
生成接口文档
访问:/api
prisma => ORM数据库
安装
npm install prisma --save-dev
npx prisma init
安装prisma/clien依赖
npm install @prisma/client
声明model时 ,创建数据库
npx prisma db push
创建一个src prisma 模块
nest g s prisma --no-spec
service.ts
import { Injectable, OnModuleInit } from '@nestjs/common';
import { PrismaClient } from '@prisma/client';
@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit {
async onModuleInit() {
await this.$connect();
}
}
使用:
声明model
id String
标签:sprisma,npm,prisma,PrismaClient,client,orm,OnModuleInit,Swagge
From: https://www.cnblogs.com/mykai/p/17756034.html