Next.js Discord

Discord Forum

How can I build my app, if its making 200+requests to the api in build time?

Palomino posted this in #help-forum
Open in Discord
Trying to make a blog website, the problem? If I try to build it , it will literally do 200+ requests to my laravel api in one second, and crash...
in the [slug] page,
//So I am generating the pages statically with generateStaticParams
export async function generateStaticParams() {
const posts = await postSlugGet();
return posts;

// Before this way, I had each post fetching individually postGet(id)
// But now I decided to use this way, because I thought nextJs would memorize this fetch, instead of doing it over and over again...
export default async function PostPage(props: any) {
const allPosts = await postGETAll();
return (...)

I am hiding a lot of code here, I dont think is necessary.... All tutorials and GPT's are not helping me at all. Believe me, I been trying solutions all day.

0 Replies