Using Nuxt/Content works in nuxt dev but doesn't work after nuxt generate
Basically what the title says. I have a web app that is completely working when I do npm run dev but then when I run npm run generate and npx serve .output/public, I get a bunch of 404 errors. Any help would be greatly appreciated.
4 Replies
const fetchData = async():Promise<BlogPost[]> => {
const { data } = await useAsyncData('blogs',() => queryContent('/blog').find())
console.log(data)
if(data.value && Array.isArray(data.value)) {
return data.value.map((item:any) => ({
description: item.description,
date: item.date,
tags: item.tags,
title: item.title,
content: item
})) as BlogPost[]
}
return []
}
this is one of the ways I'm retrieving data btw
You need ssr: true
still doesnt work
thats my updated nuxt.config.ts
these are my errors btw
maybe try adding prerender to the nitro config?