💽 API Route Fetching

Fetch data from an API route

route.tsx
import { prisma } from '@/lib/prisma';
import { NextResponse } from 'next/server';

export async function GET(request: Request) {
  const users = await prisma.user.findMany();
  console.log(users);

  return NextResponse.json(users);
}

Questions? Let's chat

Open Discord