How to do it...

  1. Create the project from the following template:
$ sls create --template-url https://github.com/danteinc/js-cloud-native-cookbook/tree/master/ch5/cognito-authorizer --path cncb-cognito-authorizer
  1. Navigate to the cncb-cognito-authorizer directory with cd cncb-cognito-authorizer.
  2. Review the file named serverless.yml with the following content:
service: cncb-cognito-authorizerprovider:  name: aws  # cfnRole: arn:aws:iam::<account-number>:role/${opt:stage}-cfnRole  ...functions:  hello:    handler: handler.hello    events:      - http:          ...          authorizer:            arn: ${cf:cncb-cognito-pool-${opt:stage}.userPoolArn}
  1. Install the dependencies with npm install.
  2. Run the tests with npm test -- -s $MY_STAGE.
  3. Review the contents generated in the .serverless ...

Get JavaScript Cloud Native Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.