Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

lambda-simple-response

classtinginc4MIT0.0.1

simple response for lambda with logging

lambda, aws-lambda, response, simple-response, utility, aws

readme

lambda-simple-response

Very simple response with logging for lambda.

Basically, lambda-simple-response leaves log and invoke callback function passed in.

To stop lambda process as soon as you call lambda-simple-response, set callbackWaitsForEmptyEventLoop of context as true(false by default)

Install

$ npm install --save lambda-simple-response

Usage

const response = require('lambda-simple-response');

module.exports.handler = (event, context, callback) => {
  context.callbackWaitsForEmptyEventLoop = false;

  let result = {
    'message': 'success'
  };
  let err = {
    'message': 'error'
  };

  if (err) response.error(err, "Error JSON:", callback);
  else response.success(result, "handler:", "success", callback);
};