NextJS Fetching an image that statically served from a microservice
Hey all. There's a Java backend that's hosting some images. I would like to have a nextJS api route that's going to fetch an image from there and then return it so the NextJS client can use it.
Right now I'm doing:
const imageRes = await apiFetch(apiURL)
const imageRes = await apiFetch(apiURL)
So far so good but
imageRes
imageRes
is still a promise (as the name implies). I want to return the actual image but
.json()
.json()
doesn't work because it's an image and can't be converted into a JS object