aws-reply

0.1.7 • Public • Published

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'
  	}
  }
}
*/

Readme

Keywords

Package Sidebar

Install

npm i aws-reply

Weekly Downloads

1

Version

0.1.7

License

MIT

Last publish

Collaborators

  • nya