Giter VIP home page Giter VIP logo

aws-serverless-subscription-service-node's Introduction

Building Subscription Service

Summary

This is the code example for the blog post Building Serverless Subscription Service using Lambda@Edge Our example application supports providing a custom experience for website visitors who sign in to the site, so we start by authenticating users when they navigate to the website in their browser.

Step-by-Step Setup Guide

$ npm install -g serverless
$ git pull https://github.com/aws-samples/aws-serverless-subscription-service-node.git
$ cd to the repository folder
$ npm install package.json --save
$ serverless deploy -v
  • In the CloudFormation console, when the application is complete, click the output URL to verify the deployment.

  • In the paywall_edge_function folder, update the config.js file using the CloudFormation output.

  • Update the config.js by replacing cloudfront-distro-id with your CloudFront distribution ID.

config.web.rootPath = 'https://cloudfront-distro-id.execute-api.us-east-1.amazonaws.com/dev';
config.web.hostName = 'cloudfront-distro-id.execute-api.us-east-1.amazonaws.com';
config.web.headlessCmsUrl = 'https://cloudfront-distro-id.execute-api.us-east-1.amazonaws.com/dev/articlesexportall';
  • After you update the config.js file, create the Lambda zip file by using following commands:
npm install package.json --save
zip paywall.zip *
  • More information about how to create a Lambda deployment package can be found in our documentation

  • In the AWS Lambda console, create a new Lambda function. Use paywall.zip as the codebase for the function.

  • In the CloudFront console, create a distribution following the steps in the blog post.

  • Under Add triggers, choose CloudFront, and then add viewer-request triggers for /login, /api/login, and /articles by adding cache behaviors for each one. You can find step-by-step instructions in our documentation

  • You can also refer the screenshots included in screenshots directory in the repository.

aws-serverless-subscription-service-node's People

Contributors

jpeddicord avatar skvasant avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.