
✅ 사용 예시
async function getInitialProducts() {
console.log("hit!!!!!");
const products = await db.product.findMany({
select: {
title: true,
price: true,
created_at: true,
photo: true,
id: true,
},
// take: 1,
orderBy: {
created_at: "desc",
},
});
return products;
}
export type InitialProducts = Awaited<ReturnType<typeof getInitialProducts>>;
Prisma.PromiseReturnType -> Prisma 6.x 이상에서는 제거됨
'♣️ Next.js 14' 카테고리의 다른 글
| Next.js 14 - Pages router vs App router 한 눈에 비교 (0) | 2025.12.11 |
|---|---|
| Next.js 14 - 원 단위로 바꾸기, 날짜 포맷하기 (0) | 2025.12.03 |
| Next.js 14 - Image component (0) | 2025.12.03 |
| Next.js 14 - Middleware, Matcher (0) | 2025.12.03 |
| Next.js 14 - useFormState(useActionState) (0) | 2025.09.17 |