AWS Launches Serverless React Starter Kit
In addition to the immensely popular React library, the GitHub-hosted kit demonstrates serverless computing using AWS Lambda -- in which code functions are triggered in response to events -- and one-click deployment to the Mobile Hub. That latter feature is enabled by the new Deploy from GitHub button".
AWS yesterday announced improvements to the Mobile Hub's Cloud Logic functionality. Part of that involves letting developers include custom AWS Lambda functions in projects launched with the company's import tool.
"With the Cloud Logic import feature, developers can also specify environment variables and CORS settings, allowing for the same code to be used for multiple functions with different settings (for example, test vs. production workloads or CRUD API for different tables within a DynamoDB database)," AWS said in a post. "The Cloud Logic import feature will also provide appropriate authorization for a linked Amazon DynamoDB database and Amazon API gateway, taking care of all resource deployments, service connections and IAM configuration with a single command."
Those and other capabilities are demonstrated in the starter kit, which generates a mobile-optimized Web app that can be run locally via a webpack server or as a static site hosted in an Amazon S3 bucket.
"You can register users in the system and log user in with SMS-based MFA," AWS' Richard Threlkeld said in another blog post yesterday. "After they are signed in, users can insert sample data for 'BBQ Restaurants' and view all restaurants in the system. They can then navigate to see everything on the menu and place an order. The sample also demonstrates using forgotten password workflows."
AWS said the app simplifies the complicated details associated with serverless Web sites, such as registration, sign-in, managing API routing, managing CORS settings, endpoint authorization, user authentication and so on.
For example, the import tool can automatically configure elements such as:
- Amazon Cognito User Pools and Federated Identities
- Amazon API Gateway, AWS Lambda, and Amazon DynamoDB
- Cross-origin resource sharing (CORS) for the API
- IAM roles and policy for the Lambda execution role
- IAM roles and policy for the user roles that access API routes after authentication
The React starter kit was released with an open source license.
David Ramel is the editor of Visual Studio Magazine.