- Create the project from the following template:
$ sls create --template-url https://github.com/danteinc/js-cloud-native-cookbook/tree/master/ch3/esg-inbound --path cncb-esg-inbound
- Navigate to the cncb-esg-inbound directory with cd cncb-esg-inbound.
- Review the file named serverless.yml with the following content:
service: cncb-esg-inboundprovider: name: aws runtime: nodejs8.10 iamRoleStatements: ...functions: webhook: handler: handler.webhook events: - http: path: webhook method: post environment: STREAM_NAME: ${cf:cncb-event-stream-${opt:stage}.streamName}
- Review the file named handler.js with the following content:
module.exports.webhook = (request, context, callback) => { const body = JSON.parse(request.body); const ...