I am new to the Moleculer framework and need to upload a file from an API request body to MongoDB using an action handler. I have been able to upload files using Multer with Express, but I need to use only the Moleculer framework. When I run the action handler, the "req" parameter doesn't take the file from the request body and it's always undefined. I need help finding a way to make the file come to the action handler.
(https://i.stack.imgur.com/Xv7YP.png)
actions: {
create: {
rest: "POST /",
async handler(ctx) {
try {
console.log("Params are: " + ctx.params.file);
console.log("Meta is: " + ctx.meta.file);
console.log("File is: " + ctx.file);
} catch(err) {
console.log("Error: " + err);
}
}
},
},