Guest User

Untitled

a guest
Jun 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. PostFunction:
  2. Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
  3. Properties:
  4. CodeUri: hello_world/
  5. Handler: apppost.lambda_handler
  6. Runtime: nodejs8.10
  7. Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
  8. Variables:
  9. PARAM1: VALUE
  10. Events:
  11. PostHello:
  12. Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
  13. Properties:
  14. Path: /posthello
  15. Method: post
  16.  
  17. exports.lambda_handler = async (event, context, callback) => {
  18. try {
  19. response = {
  20. 'statusCode': 200,
  21. 'body': JSON.stringify({
  22. message: context,
  23. })
  24. }
  25. }
  26. catch (err) {
  27. console.log(err);
  28. callback(err, null);
  29. }
  30.  
  31. callback(null, response)
  32. };
Add Comment
Please, Sign In to add comment