es to es una prueba
import { notFound } from "next/navigation";
export async function fetchPosts() {
console.log(process.env.NEXT_PUBLIC_DEVTO_USERNAME);
const res = await fetch(
`https://dev.to/api/articles?username=${process.env.NEXT_PUBLIC_DEVTO_USERNAME}`,
{
next: { revalidate: 3 * 60 * 60 },
}
);
if (!res.ok) notFound();
return res.json();
}
export async function fetchPost(slug) {
const res = await fetch(
`https://dev.to/api/articles/${process.env.NEXT_PUBLIC_DEVTO_USERNAME}/${slug}`,
{
next: { revalidate: 3 * 60 * 60 },
}
);
if (!res.ok) notFound();
return res.json();
}
Top comments (0)