usage:
const AwsReply = require('aws-reply')
const areply = new AwsReply({'X-Default-Header': 'hello'})
// json response
areply.json(callback, error, data [, statusCode])
// html response
areply.html(callback, error, data [, statusCode])
example:
const AwsReply = require('aws-reply')
const areply = new AwsReply() // not setting a default header
module.exports.helloWorld = (event, context, callback) => {
areply.json(callback, null, {'hello': 'world'})
}
/* response:
{
'headers': {
'Content-Type': 'application/json'
},
'statusCode': 200,
'body': {
'success': true,
'result': {
'hello': 'world'
}
}
}
*/