I'm making an API that takes an image from the database by getting it using the URL like this (http://localhost:3000/city/?name=encenadaport&width=200&height=200) I made the code and the function that handle the resizing issue the problem is when I write the URL it gives me Error: ENOENT: no such file or directory, stat 'D:\Programming\Udacity_FWD\Projects\Image_Api\assets\thumbnail\santamonica_300_200.png' and when I rerun it works I think it sends a response before it creates the resized image what shall I do this is the part that handles the resizing
enter code here
imgResize(imageLoc, name as string, width, height, newLocation);
res.sendFile(`${newLocation}/${name}_${width}_${height}.png`);