Why to separate the Lambda handler from the core logic?

0 votes

So, I've recently started experimenting with the lambda function and I read it somewhere that I need to separate the Lambda handler (entry point) from the core logic. can you explain why?

May 20 in AWS by Yamini
90 views

1 answer to this question.

0 votes

Separating the Lambda handler (entry point) from the core logic allows you to make a more unit-testable function. In Node.js this may look like:

exports.myHandler = function(event, context, callback) {
var foo = event.foo;
var bar = event.bar;
var result = MyLambdaFunction (foo, bar);
callback(null, result);
}
function MyLambdaFunction (foo, bar) {
// MyLambdaFunction logic here
}
answered May 20 by Tushar

Related Questions In AWS

0 votes
1 answer

How to invoke the AWS lambda function from Java code

There are 2 methods in this class which should ...READ MORE

answered Feb 19 in AWS by Archana
• 5,580 points
1,282 views
+1 vote
2 answers
0 votes
1 answer
+1 vote
3 answers

Not able to pass params POST to AWS Lambda from Amazon API Gateway

For this template : application/x-www-form-urlencoded  This line below will ...READ MORE

answered Jun 13, 2018 in AWS by Cloud gunner
• 4,280 points
2,520 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer