chore: add nextjs template

This commit is contained in:
Pranav Putta
2026-02-19 12:10:51 -08:00
parent 0283cf7ee7
commit a7675e42cd
18 changed files with 443 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
export type Product = {
id: number;
title: string;
price_cents: number;
image_url: string;
};
export async function fetchProducts(): Promise<Product[]> {
const res = await fetch("/api/products", { cache: "no-store" });
if (!res.ok) {
throw new Error("Failed to fetch products");
}
return res.json();
}
export async function fetchProduct(productId: string): Promise<Product> {
const res = await fetch(`/api/products/${productId}`, { cache: "no-store" });
if (!res.ok) {
throw new Error("Failed to fetch product");
}
return res.json();
}