Response rows: [ anonymous { today: 2017-08-14T00:08:52.643Z } ] - Node version v8.2.1 -


i'm working node-postgres , try make first example

and create class called postgres method today

const conn = new pg.pool({   user: 'user',   host: 'localhost',   database: 'test',   password: 'pass',   port: 5432, });  class postgres {    today() {     conn.query("select now() today",(err,res)=>{         if (err) throw err             //console.log(json.stringify(res.rows[0]));             return json.stringify(res.rows[0]);             conn.end();     })      } } 

the result rows: [ anonymous { today: 2017-08-14t00:08:52.643z } ] , try json.stringify(res.rows[0]) not working can't field

result {   command: 'select',   rowcount: 1,   oid: nan,   rows: [ anonymous { today: 2017-08-14t00:08:52.643z } ],   fields:    [ field {        name: 'today',        tableid: 0,        columnid: 0,        datatypeid: 1184,        datatypesize: 8,        datatypemodifier: -1,        format: 'text' } ],   _parsers: [ [function: parsedate] ],   rowctor: [function: anonymous],   rowasarray: false,   _gettypeparser: [function: bound ] } 

any sugestion apreciated


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -