14 lines
326 B
TypeScript
14 lines
326 B
TypeScript
import { PrismaClient } from '@prisma/client';
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function main() {
|
|
const posts = await prisma.blogPost.findMany({
|
|
orderBy: { createdAt: 'desc' },
|
|
take: 5
|
|
});
|
|
console.log(JSON.stringify(posts, null, 2));
|
|
}
|
|
|
|
main().catch(console.error).finally(() => prisma.$disconnect());
|