Braveheart
Explore posts from serversPrisma and deno
getting this
from this
following https://github.com/denoland/examples/tree/main/with-prisma
error: could not find package '.prisma' from referrer 'file:///Users/nikos/WebstormProjects/vanillajs-patterns/backend/node_modules/.deno/@[email protected]/node_modules/@prisma/client/index.js'.
error: could not find package '.prisma' from referrer 'file:///Users/nikos/WebstormProjects/vanillajs-patterns/backend/node_modules/.deno/@[email protected]/node_modules/@prisma/client/index.js'.
import { Prisma, PrismaClient } from '@prisma/client';
import { config } from 'https://deno.land/[email protected]/dotenv/mod.ts';
import * as bcrypt from 'https://deno.land/x/bcrypt/mod.ts';
const envVars = await config();
const prisma = new PrismaClient({
datasources: {
db: {
url: envVars.DATABASE_URL,
},
},
});
const seedData: Prisma.UserCreateInput[] = [
{
name: 'Tony',
email: '[email protected]',
passwordHash: await bcrypt.hash('password', 10),
emailVerified: true,
customFields: {
test: 'field',
},
},
{
name: 'Nikos',
email: '[email protected]',
passwordHash: await bcrypt.hash('password', 10),
emailVerified: true,
},
];
/**
* Seed the database.
*/
for (const u of seedData) {
const dinosaur = await prisma.user.create({
data: u,
});
console.log(`Created dinosaur with id: ${dinosaur.id}`);
}
console.log(`Seeding finished.`);
await prisma.$disconnect();
import { Prisma, PrismaClient } from '@prisma/client';
import { config } from 'https://deno.land/[email protected]/dotenv/mod.ts';
import * as bcrypt from 'https://deno.land/x/bcrypt/mod.ts';
const envVars = await config();
const prisma = new PrismaClient({
datasources: {
db: {
url: envVars.DATABASE_URL,
},
},
});
const seedData: Prisma.UserCreateInput[] = [
{
name: 'Tony',
email: '[email protected]',
passwordHash: await bcrypt.hash('password', 10),
emailVerified: true,
customFields: {
test: 'field',
},
},
{
name: 'Nikos',
email: '[email protected]',
passwordHash: await bcrypt.hash('password', 10),
emailVerified: true,
},
];
/**
* Seed the database.
*/
for (const u of seedData) {
const dinosaur = await prisma.user.create({
data: u,
});
console.log(`Created dinosaur with id: ${dinosaur.id}`);
}
console.log(`Seeding finished.`);
await prisma.$disconnect();
22 replies