update for id bug 46
This commit is contained in:
25
server.js
25
server.js
@ -142,8 +142,8 @@ app.post('/csv', (req, res, next) => {
|
||||
try {
|
||||
const path = '/var/www/html/appexe/natnats/23/bin/mobileweb2/resources/database/user_record.csv';
|
||||
if (fs.existsSync(path)) {
|
||||
fs.createReadStream(path)
|
||||
.pipe(parse({ delimiter: ",", from_line: 2 }))
|
||||
const readable = fs.createReadStream(path);
|
||||
readable.pipe(parse({ delimiter: ",", from_line: 2 }))
|
||||
.on("data", function (row) {
|
||||
console.log("--- r-0 ----", row[0]);
|
||||
if(row[0] === _userEmail){
|
||||
@ -165,16 +165,17 @@ app.post('/csv', (req, res, next) => {
|
||||
|
||||
|
||||
});
|
||||
fs.destroy();
|
||||
if(_res === ""){
|
||||
fs.appendFile(path, csv, function (err) {
|
||||
if (err) throw err;
|
||||
console.log('The "data to append" was appended to file!');
|
||||
});
|
||||
// writetoFile(csv);
|
||||
_res = _jsessionid;
|
||||
res.send({'id': _res});
|
||||
}
|
||||
readable.on("close", () => {
|
||||
if(_res === ""){
|
||||
fs.appendFile(path, csv, function (err) {
|
||||
if (err) throw err;
|
||||
console.log('The "data to append" was appended to file!');
|
||||
});
|
||||
// writetoFile(csv);
|
||||
_res = _jsessionid;
|
||||
res.send({'id': _res});
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch(err) {
|
||||
console.log("---error -----");
|
||||
|
||||
Reference in New Issue
Block a user