Skip to content

Instantly share code, notes, and snippets.

@dwelch2344
Last active January 12, 2018 23:57
Show Gist options
  • Save dwelch2344/4e0b018c68eedd400dc3adddc8344985 to your computer and use it in GitHub Desktop.
Save dwelch2344/4e0b018c68eedd400dc3adddc8344985 to your computer and use it in GitHub Desktop.
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