Skip to content

jamesjessian/lambda-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lambda-example

Example REST service for Lambda article I wrote: https://medium.com/p/4730c88cd39a

  • EmailServices.js - a small JavaScript class containing services to get/send e-mail.

  • lambdaHandlers.js - contains a set of Lambda handler functions which wrap the EmailServices methods. These handler functions are designed to be deployed to AWS Lambda, accepting parameters of event, context and callback. They extract parameters from the event object and return a response object to the callback.

  • serverless.yaml - a configuration file for the Serverless Framework. If you run npm run deploy it will call serverless deploy, which itself will look at that configuration file to determine what to deploy to AWS (in this case, the functions in lambdaHandlers.js as Lambda functions, and some http endpoints in API Gateway to trigger those Lambda functions). It will also expect to find a file called env.yml containing environment variables for the deployed services. I'm not sure what happens if that file doesn't exist.

  • examples Contains examples for the env.yml file, what an event object looks like, what a context object looks like, and an example of a JSON file that can be used to test a Lambda function locally, like:

serverless invoke local -f getEmail -p example.json

Releases

No releases published

Packages

No packages published