0

does anyone know how can i fetch data from my strapi api?

my usual code for fetching data in nextjs 13 is :

const fetchProducts = async () => {
  const res = await fetch('https://fakestoreapi.com/products');
  const items = await res.json();
  return items;
};

but i don't know how to adapt it for strapi... i set up my strapi account following this tutorial (https://www.youtube.com/watch?v=BCkWFblNLKU&t=6791s) but they're using react app and i need it for nextjs 13 without the use of axios or getStaticProps. Can anyone help me? i've been having trouble learning nextjs cause there are barely any tutorials out there for the beta version ...

queercoded
  • 55
  • 9
  • Hi, the fetch for strapi looks exactly the same, all you need to do is add permissions so you can fetch, you do that in settings > roles in strapi admin – antokhio Dec 21 '22 at 22:37

0 Answers0