the task i am trying to accomplish here is to upload pictures to mongo db using node and render them using react in the front end.
I do manage to upload pics using insomnia to mongo. the issue is i cant decode them. or at least that’s where i think the issue is.
Here are all the steps i have followed:
- i have created a schema:
2.i have created a storage method, an upload , a addimages and get images methods:
- Hooked them up to the router
- added some pics jiff but also png too to the database and checked if db was populated correctly which it has:
- on the front end i get the images with an axios request and save them to state:
- i am getting the images from the state (escImages) loop through and try to render them to the screen
- this is what i get:
The images aren’t rendering for some reason!!! any idea what that might be?
Where em i wrong?
images are saved and the mongo db on a separate collection and also on a local folder under the name pictures.
Still i am not sure what the issue is and cant render them on the screen.
i have tried to render the images to the screen getting them from mongo db and still cant achieve it. i think there is an issue with decoding the pics? i am not sure.