Skip to content

classtinginc/lambda-simple-response

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);
};

About

simple lambda response with logging

Resources

License

Stars

Watchers

Forks

Packages

No packages published