Deployable hello function behind api gateway
This commit is contained in:
14
handler.js
14
handler.js
@@ -1,14 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
module.exports.hello = async (event, context) => {
|
|
||||||
return {
|
|
||||||
statusCode: 200,
|
|
||||||
body: JSON.stringify({
|
|
||||||
message: 'Go Serverless v1.0! Your function executed successfully!',
|
|
||||||
input: event,
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
|
|
||||||
// Use this code if you don't use the http event with the LAMBDA-PROXY integration
|
|
||||||
// return { message: 'Go Serverless v1.0! Your function executed successfully!', event };
|
|
||||||
};
|
|
||||||
@@ -20,6 +20,7 @@ service: eg-api # NOTE: update this with your service name
|
|||||||
provider:
|
provider:
|
||||||
name: aws
|
name: aws
|
||||||
runtime: nodejs8.10
|
runtime: nodejs8.10
|
||||||
|
region: us-east-2
|
||||||
|
|
||||||
# you can overwrite defaults here
|
# you can overwrite defaults here
|
||||||
# stage: dev
|
# stage: dev
|
||||||
@@ -56,7 +57,11 @@ provider:
|
|||||||
|
|
||||||
functions:
|
functions:
|
||||||
hello:
|
hello:
|
||||||
handler: handler.hello
|
handler: handlers/hello/get.hello
|
||||||
|
events:
|
||||||
|
- http:
|
||||||
|
path: hello
|
||||||
|
method: get
|
||||||
|
|
||||||
# The following are a few example events you can configure
|
# The following are a few example events you can configure
|
||||||
# NOTE: Please make sure to change your handler code to work with those events
|
# NOTE: Please make sure to change your handler code to work with those events
|
||||||
@@ -102,3 +107,6 @@ functions:
|
|||||||
# NewOutput:
|
# NewOutput:
|
||||||
# Description: "Description for the output"
|
# Description: "Description for the output"
|
||||||
# Value: "Some output value"
|
# Value: "Some output value"
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
- serverless-offline
|
||||||
Reference in New Issue
Block a user