handled a returned array as opposed to a returned object
This commit is contained in:
parent
3d9bc487ba
commit
0b5ee0bdf3
6
index.js
6
index.js
@ -39,8 +39,12 @@ Postgres.FirstRow = function(inSQL, args, inResponse) {
|
|||||||
if (err === null) {
|
if (err === null) {
|
||||||
//need to test if the response is an object or an array
|
//need to test if the response is an object or an array
|
||||||
//inResponse.json(res.rows[0]);
|
//inResponse.json(res.rows[0]);
|
||||||
//if (Array.isArray(res)) {}
|
if (Array.isArray(res)) {
|
||||||
inResponse.json(res[1].rows[0]);
|
inResponse.json(res[1].rows[0]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
inResponse.json(res.rows[0]);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(err.stack);
|
console.log(err.stack);
|
||||||
|
Loading…
Reference in New Issue
Block a user