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