Skip to content

Commit

Permalink
refactor(init): renamed handler for camel case, moved callback call up (
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcasalboni authored and jfuss committed Aug 2, 2018
1 parent 4ae2f7c commit bd3c3bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ let response;
*
*/
{%- if cookiecutter.runtime == 'nodejs6.10' or cookiecutter.runtime == 'nodejs4.3' %}
exports.lambda_handler = function (event, context, callback) {
exports.lambdaHandler = function (event, context, callback) {
axios(url)
.then(function (ret) {
response = {
Expand All @@ -61,7 +61,7 @@ exports.lambda_handler = function (event, context, callback) {
});
};
{%- else %}
exports.lambda_handler = async (event, context) => {
exports.lambdaHandler = async (event, context) => {
try {
const ret = await axios(url);
response = {
Expand All @@ -71,8 +71,7 @@ exports.lambda_handler = async (event, context) => {
location: ret.data.trim()
})
}
}
catch (err) {
} catch (err) {
console.log(err);
return err;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Resources:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: hello_world/
Handler: app.lambda_handler
Handler: app.lambdaHandler
{%- if cookiecutter.runtime == 'nodejs6.10' %}
Runtime: nodejs6.10
{%- elif cookiecutter.runtime =='nodejs4.3' %}
Expand Down

0 comments on commit bd3c3bc

Please sign in to comment.