I am making an application using Node.js
and Express
. I am able to save files to the server using multer
, however while sending responses I have two options,
- Send the URI of the image in JSON, and let the front-end call this to display the image.
- Send the image data using some form of encoding like Base64 as part of JSON.
Since I am new to web development, I am confused as to which option to use. Some people have said that the first option requires two API calls, so can be slow. While I have also heard that the second option will take up more memory resources.
What other things should I consider while choosing, and is there any other way of sending images to the client side?