please I am working with the new strapi v4 and... In the old versions of strapi all I needed to do in order to get the image from my collection type was to get it like:
<img src={config.baseURL + product?.productImg?.formats?.thumbnail?.url} />
but when I try to do the same now, it gives me the url address, but the response says
{"data":null,"error":{"status":404,"name":"NotFoundError","message":"Not Found","details":{}}}
Any help?
I realised it. In my config file I had the baseURL as 'localhost:1337/api'. However for images, you must request without the '/api' so the request should be just 'localhost:1337' and then the image route.
with strapi v4 u need to manually populate your rest api with images otherwise it's restricted due to security reasons :
localhost:1337/api/posts?populate=*
then you will get images on your endpoint