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/ch6/feature-flag --path cncb-feature-flag
  1. Navigate to the cncb-feature-flag directory with cd cncb-feature-flag.
  1. Review the file named src/Authorize.js, as follows:
...const getGroups = props => get(props,    'auth.cognito.signInUserSession.idToken.payload.cognito:groups', '');const check = (allowedRoles, props) => {  const groups = getGroups(props);  return intersection(groups, allowedRoles).length > 0;};const HasRole = allowedRoles =>  props => check(allowedRoles, props) ?    props.children :    null;export const HasAuthorRole = HasRole(['Author']);export const HasBetaUserRole = HasRole ...

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.