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/ch4/cdn-dns --path cncb-cdn-dns
  1. Navigate to the cncb-cdn-dns directory with cd cncb-cdn-dns.
  2. Review the file named serverless.yml with the following content:
service: cncb-cdn-dnsprovider:  name: awsplugins:  - serverless-spa-deploy  - serverless-spa-configcustom:  spa:    files:      ...     dns:    hostedZoneId:  Z1234567890123    domainName: example.com    endpoint: app.${self:custom.dns.domainName}
  1. Update the serverless.yml file with your hostedZoneId and domainName.
  2. Install the dependencies with npm install.
  3. Run the tests with npm test.
  4. Review the contents generated in the .serverless directory:

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.