I am using dropzone to upload the file. On the server side I am using node and expressjs. I am also using multer as the file handling middleware.
dropzone makes a call to one endpoint to save the file on the server.
On the server side, I created an endpoint to handle the file:
exports.saveFile = function (req, res) {
console.log(req.files);
return res.status(200);
//I have not added any file save logic here
};
This is how I have configured multer
var app = express();
var server = require('http').createServer(app);
app.use(multer({ dest: './uploads/'}));
Looks like multer automatically saves the file into the uploads
folder.
Problem: Even though the file is saved on the server, the request remains in pending state on the client side.
How can I return success response from the server to the client?
Do I need to add some code on the endpoint I have created or I need to add required logic under onFileUploadComplete() given by multer?