AWS Lambda node.js template

The node.js based implementation of AWS Lambdas has the following structure:

Using ES6 fat arrow syntax:

exports.handlerName = (event, context, callback) => {
  callback(error, result);
}

where error is either null for a successful execution, or an error, and result is a response to return to your caller.

Using ES5 syntax:

exports.handlerName = function(event, context, callback) {
  callback(error, result);
}

For more info, see here.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.