Skip to content

Commit

Permalink
send csv to server & receives data in json response
Browse files Browse the repository at this point in the history
  • Loading branch information
longtran1904 committed Jul 5, 2023
1 parent 19a53b8 commit 2eac2ab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/api/controllers/submission.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@ const convertCSVtoJSON = async (req, res) => {
const form = formidable({ multiples: true });
let filepath;

console.log(req.body);

Check warning on line 63 in server/api/controllers/submission.controller.js

View workflow job for this annotation

GitHub Actions / test-endpoints

Unexpected console statement

form.parse(req, async (err, fields, files) => {
if (err) {
res.writeHead(err.httpCode || 400, { 'Content-Type': 'text/plain' });
res.end(String(err));
return;
}

filepath = files.file.path;
console.log(files);

Check warning on line 72 in server/api/controllers/submission.controller.js

View workflow job for this annotation

GitHub Actions / test-endpoints

Unexpected console statement

filepath = files.file.filepath;
const JSONSubmissions = await convertCSV(filepath);
if (JSONSubmissions) {
res.send(JSON.stringify(JSONSubmissions));
Expand Down

0 comments on commit 2eac2ab

Please sign in to comment.