Search code examples
node.jsreactjsimage-upload

Display image on react app from node js server


I am creating an react app using create-react-app for school management system. I had used node js for creating api end point. I am able to store student detail and can fetch it back to display in react. I had created an endpoint for uploading student images, which is also working perfect. I had stored the image on node js server public folder. I know it should be on client public folder but if another application for example android or angular or vue application tries to call the same image will not get as it will be stored in react public folder.

So how could I solve the image problem?


Solution

  • You've done all the logic right, just add image URL to user profile, for example :

    imageUrl: 'https://{your API URL}'

    or the better way to upload all images on file server like S3 or Google Cloud Storage, and save only link to image on user profile