Just to inform that backend is in NodeJS and frontend in ReactJS. [enter image description here][1] [1]: https://i.stack.imgur.com/ifklU.png
I have added how my structure of project look like in image. When client save image/file it saves under backend in folder named uploadedData. Consider that I already know the name of photo and of course directory also. Can someone explain me how can I get image from
uploadedData
directory from backend and show on frontend with the help of
components/Products.js
which is part of frontend. Since I am newbie it would be good if I get little detailed answer.
Note: I have achieved this thing with really poor approach:
Writing this line of code
app.use('/uploadedData', express.static(__dirname + '/uploadedData'))
allow me to see image directly on the browser at http://localhost:8081/uploadedData/artikles/1222222.jpg
and if I write the same url equal to src
in the <img>
tag I have achieved the goal but I want to get better approach.