Last active
January 12, 2018 23:57
-
-
Save dwelch2344/4e0b018c68eedd400dc3adddc8344985 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports.example = (event, context, callback) => { | |
var Client = require('pg').Client | |
var pg2 = new Client({ | |
connectionString: process.env.dbUrl | |
}) | |
console.log('client') | |
pg2.connect() | |
console.log('connect') | |
pg2.query('SELECT NOW()', (err, res) => { | |
console.log('success', res.rows[0]) | |
var data = JSON.stringify(res.rows[0]) | |
callback(null, { | |
statusCode: 200, | |
body: data | |
}) | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment