Hono ve Prisma ile D1
Ders 19: Hono ve Prisma ile D1
Section titled “Ders 19: Hono ve Prisma ile D1”Öğrenme Hedefleri
Section titled “Öğrenme Hedefleri”- Hono framework ile D1 entegrasyonu
- Prisma ORM kullanımı
- Type-safe sorgular
İçerik
Section titled “İçerik”Hono ile D1
Section titled “Hono ile D1”import { Hono } from 'hono';
const app = new Hono<{ Bindings: Env }>();
app.get('/users', async (c) => { const { results } = await c.env.DB.prepare('SELECT * FROM users').run(); return c.json(results);});Prisma ile D1
Section titled “Prisma ile D1”import { PrismaClient } from '@prisma/client';import { PrismaD1 } from '@prisma/adapter-d1';
const prisma = new PrismaClient({ adapter: new PrismaD1(),});
const users = await prisma.user.findMany();✅ Hono integration ✅ Prisma ORM
Sonraki Ders
Section titled “Sonraki Ders”Diğer Frameworkler - Remix, SvelteKit.
Ders Süresi: 75 dakika Zorluk Seviyesi: İleri