最佳答案
Okay so i am using the FileUploader
module to upload my file from angular to my REST API
:
var uploader = $scope.uploader = new FileUploader({
url: api.getUrl('uploadCompetence',null)
});
This is sent to the following POST
function:
router.route('/api/uploadCompetence')
.post(function (req, res) {
// This is where i want to read the file
var competence = Competence.build(req.body.location);
competence.add(function (success) {
res.json({message: 'quote created!'});
},
function (err) {
res.status(err).send(err);
});
})
Now my goal is to read the excel
file and then add each row to my database.
However im not quite sure how i can read the file from Node.js
i have debugged my server and couldnt find the file anywhere but the the api is being called from my Angular
application
Can anyone push me in the right direction? :)