mercredi 13 décembre 2017

How to wait for image before calling res.send()

I have a route in express that returns an image with res.send() to an ember frontend. I have another route which I intermitently use to save an image using a Raspberry Pi. Sometimes when I call the route which wishes to return the image, there is no image available.

How would I go about waiting for the image to be saved before returning the image back to the user instead of sending them back error: no image.

The image is saved in backend/images inside of my express application. So far I have tried to us FS but with no avail!

Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire