I have a node endpoint with takes post request for uploading files. I am able to read the data(file) being send from the browser, now I want to forward the data or the whole request to another server hosted somewhere else. I am using node, express and express-fileupload. I am open to get rid on express-fileupload plugin if required. Following is what I have
app.post("/uploadImage", (req, res) => {
const headers = {
"Content-Type": "multipart/form-data"
};
axios
.post("http://139.59.80.251:8080/homely/images", req.files.file.data, {
headers: headers,
})
.then((resp) => {
res.send(resp);
})
.catch((e) => {
res.status(500).send(e);
});
});
Any help is appreciated.