Hey! i have an app with Astrojs - TailwindCSS & Strapi but i got a problem cause **I do'nt know nothing about gsp ( GetStaticPaths ) so with Strapi i got an slug generator but i wanna make an page for each product on my api and use the slug to the page, Can anyone help me please?
#getStaticPaths Fetching data
18 messages · Page 1 of 1 (latest)
Hello @brittle ruin, did you take a look at this https://docs.astro.build/en/reference/api-reference/#getstaticpaths ?
Yup but how idk how to put the params that i get on my api
export async function getStaticPaths() {
const articles = await fetchApi<Article[]>({
endpoint: 'articles',
wrappedByKey: 'data',
});
return articles.map((article) => ({
params: { slug: article.attributes.slug },
props: article,
}));
}
type Props = Article;
const article = Astro.props;
we have a guide on how to set Astro with Strapi as well
have you taken a look at it?
@brittle ruin
Sorry @hardy shard I Wasnt home
lemme see
Theres something that i was never understand when u write this
fetchApi <Article[]>(){}```
its literally?
or what is <Article[]>?
a type
I recommend you to take a look to the guide that I just linked and see if you can manage to achieve what you're trying to do.
np, anytime
@hardy shard uh?