I have a NodeJS rest-API that accepts images and content like text in the same function.
I'm using multer in my NodeJS server to handle the images, more precisely I have the same example from below just I have content with it also.
var cpUpload = upload.fields([{ name: 'avatar', maxCount: 1 }, { name: 'gallery', maxCount: 8 }])
app.post('/cool-profile', cpUpload, function (req, res, next) {
// req.files is an object (String -> Array) where fieldname is the key, and the value is array of files
//
// e.g.
// req.files['avatar'][0] -> File
// req.files['gallery'] -> Array
//
// req.body will contain the text fields, if there were any
})
How can I send the images form Angular 4 frontend page to NodeJS backend.
Thank you!