@ previously UX/UI @ davidwells.io Refactor your React App into - - PowerPoint PPT Presentation

previously ux ui davidwells io refactor your react app
SMART_READER_LITE
LIVE PREVIEW

@ previously UX/UI @ davidwells.io Refactor your React App into - - PowerPoint PPT Presentation

I'm @DavidWells Software Developer @ previously UX/UI @ davidwells.io Refactor your React App into Angular 1 and then back to jQuery lolz jk Serverless React + Serverless: a match made in heaven Life Goals Scaling servers is... hard


slide-1
SLIDE 1
slide-2
SLIDE 2

I'm @DavidWells Software Developer

@

previously UX/UI

@

davidwells.io

slide-3
SLIDE 3

Refactor your React App into Angular 1 and then back to jQuery

slide-4
SLIDE 4

lolz jk

slide-5
SLIDE 5

Serverless

slide-6
SLIDE 6

React + Serverless: a match made in heaven

slide-7
SLIDE 7

Life Goals

slide-8
SLIDE 8

Scaling servers is... hard

slide-9
SLIDE 9

Love you Wes ❤ Check out all Wes's courses wesbos.com/courses

slide-10
SLIDE 10
  • Load balancing
  • Security concerns
  • Monitoring
  • Logging
  • follower database instances
  • costs...
  • .......
slide-11
SLIDE 11
slide-12
SLIDE 12

AWS Lambda

slide-13
SLIDE 13

Code that runs on-demand inside the cloud of your choice

  • Pay per execution pricing
  • Never pay for idle servers
  • Auto scales for you
  • Event driven workflows
  • Leverage third party services
slide-14
SLIDE 14

Code that runs on-demand inside the cloud of your choice and auth0 webtasks, oracle functions, kubernetes, & spotInst....

slide-15
SLIDE 15

use cases

slide-16
SLIDE 16

use cases

  • REST APIs, Graph APIs: lambda -> API Gateway endpoint
  • event-driven workflows, scheduled tasks, data transforms
  • real-time/streaming, batch processing: kinesis -> lambda
  • web, mobile & IoT

backends

  • form processing
  • authentication
  • devops automation
  • chatbots
  • file manipulation
  • voice apps (Alexa)
  • ETL workloads
  • image resizing
  • video transcoding
  • security audits
  • dynamic websites
  • web hook listeners
  • CRON jobs
  • CI/CD pipelines
  • log analytics

github.com/serverless/examples

slide-17
SLIDE 17

github.com/serverless/forms-service

slide-18
SLIDE 18

Frontend

  • Create React App
  • Hosted on Netlify
  • Using react router 4
  • State via Redux
  • Talks to API Gateway via axios
  • Auth via Auth0

github.com/serverless/forms-service

slide-19
SLIDE 19

Backend

  • Node backend running in AWS Lambda Functions
  • DynamoDB noSQL for database
  • Authorization via API Gateway Custom Authorizer Function

github.com/serverless/forms-service

slide-20
SLIDE 20

serverless backend

slide-21
SLIDE 21

watch Serverless Authentication and Authorization

http://bit.ly/aws-auth

slide-22
SLIDE 22

Custom Authorizer Flow

slide-23
SLIDE 23
slide-24
SLIDE 24
  • 1. Create a new auth0 client
slide-25
SLIDE 25
  • 2. Make it a SPA
slide-26
SLIDE 26
  • 3. Note the Domain & Client ID values
slide-27
SLIDE 27
  • 4. Install the auth0 Authorization extension
slide-28
SLIDE 28
  • 5. setup permissions/groups/roles
slide-29
SLIDE 29
  • 6. create a new auth0 Rule to add roles to JWT
slide-30
SLIDE 30
  • 6b. attach the users roles to the JWT on login via rule
slide-31
SLIDE 31
  • 7. plug in auth0 clientID & auth0 domain to frontend + backend

backend config.prod.json frontend _config.js

slide-32
SLIDE 32
  • 8. Deploy Backend

Take your API endpoints and plug them into the UI

slide-33
SLIDE 33
  • 8b. Add API endpoints to frontend App
slide-34
SLIDE 34
  • 9. Deploy Frontend
slide-35
SLIDE 35
  • Builds on github repo events (CI/CD flow)
  • Automatic Branch previews ⚡
  • static site redirects via `_redirects` file 👍
  • Handles proxied URLs - this gives us escape hatches for

dynamic pages/content

  • Super cheap
  • amazing support
  • 💖 them
slide-36
SLIDE 36

Custom Authorizer Implementation bit.ly/auth-code see code:

slide-37
SLIDE 37

Where to run

serverless.yml config file

When to run What to run

slide-38
SLIDE 38

named export saveUser function is referenced in serverless.yml

handler.js file

slide-39
SLIDE 39

serverless deploy in cwd framework packages & deploys code returns live API endpoints

slide-40
SLIDE 40
  • Web forms
  • Custom APIs
  • Automatic thumbnail generation
  • New user welcome emails
  • Lead revisit notifications
  • Showing related content on blog
  • Site search (Algolia)
  • Content A/B testing
  • Doc feedback

Serverless Use Cases for serverless.com

github.com/serverless/site

slide-41
SLIDE 41

GraphQL Backend API

slide-42
SLIDE 42

UI REST Backend API serverless.com/framework/status

slide-43
SLIDE 43

bit.ly/2Br7w1w

slide-44
SLIDE 44

https://servers.lol/

slide-45
SLIDE 45

github.com/serverless/examples

slide-46
SLIDE 46

Search .serverless globally on github

slide-47
SLIDE 47


 Thanks for listening! Questions? Slides: Tweet @DavidWells davidwells.io