You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/800-guides/430-nestjs.mdx
+24-17Lines changed: 24 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,15 @@ cd nestjs-prisma
42
42
43
43
You can run `npm start` to start your application at `http://localhost:3000/`. Over the course of this guide, you'll add routes to store and retrieve data about _users_ and _posts_.
44
44
45
+
In `package.json`, add the `type` field set to `"module"`:
46
+
47
+
```json file=package.json
48
+
{
49
+
// add-next-line
50
+
"type": "module"
51
+
}
52
+
```
53
+
45
54
## 2. Set up Prisma
46
55
47
56
### 2.1. Install Prisma and dependencies
@@ -73,16 +82,14 @@ This creates a new `prisma` directory with the following contents:
73
82
-`prisma.config.ts`: A configuration file for your projects
74
83
-`.env`: A [dotenv](https://github.com/motdotla/dotenv) file, typically used to store your database credentials in a group of environment variables
75
84
76
-
### 2.3. Set the generator output path and update the module format
85
+
### 2.3. Set the generator output path
77
86
78
-
Specify your output `path` for the generated Prisma client by either passing `--output ../src/generated/prisma` during `prisma init` or directly in your Prisma schema. Also, update the `moduleFormat` to `cjs`:
87
+
Specify your output `path` for the generated Prisma client by either passing `--output ../src/generated/prisma` during `prisma init` or directly in your Prisma schema:
79
88
80
89
```prisma file=prisma/schema.prisma
81
90
generator client {
82
91
provider = "prisma-client"
83
92
output = "../src/generated/prisma"
84
-
// add-next-line
85
-
moduleFormat = "cjs"
86
93
}
87
94
```
88
95
@@ -169,7 +176,7 @@ Inside the `src` directory, create a new file called `prisma.service.ts` and add
0 commit comments