Hi how are you doing? I'm having problems when it comes to displaying the image in React JS... From Node Js, I save my article with its attributes and its image in my MySQL database (I save the path of the folder where the file is located) that went up with multer). Now when I get the data of the articles from react consuming my node js API, I want to make it show me the image and I don't know how to do it, could you help me please? This is how the model is in my mysql database:
For this case we have 2 alternatives,
The first is that you store the image in a public folder of your node application:
more info
Let's say you have a public folder and within it an images folder, you could access it through this url:
http://localhost:3000/images/kitten.jpg
The other thing is that you read the image from node and encode it as a base64 and that in front you decode it in the front
If you do not have a public route to load the images and you want them to login to see them, you will have to create an endpoint to load images, then with axios in the configurations you only have to place:
and when you receive the image you convert it to display it in the src