Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Amplify FW で爆速フロント開発

Amplify FW で爆速フロント開発

LT資料

yKicchan

June 23, 2020
Tweet

More Decks by yKicchan

Other Decks in Programming

Transcript

  1. Who am I interface Me extends Person { name: "Yukiya

    Murata"; twitter: "@yKicchan"; company: "Fenrir Inc."; job: "Web engineer"; favorite: " 花澤⾹菜" | "P5R" | " ピカチュウ"; skills: "React" | "Vue.js" | "Angular" | "PHP" | "Go"; } 2 2
  2. Amplify ってなんぞ コマンド叩くだけで AWS の各種サービス作成をやってくれ る ライブラリ⼊れるだけで簡単に各種 AWS とフロントを接続 AWS

    あんま触れないけどフロントは分かるって⼈は使える 逆にネイティヴや Web わからんけど AWS 分かる⼈は微妙 3 3
  3. Amplify でできること⼀例 Cognito を利⽤した認証システム // ← 今⽇はこれする S3 + CloudFront

    を利⽤した静的サイトホスティング API Gateway + Lambda で API 作成 REST, GraphQL 両対応 GitHub や CodeCommit と連携し CI/CD 4 4
  4. Getting started $ npm install -g @aws-amplify/cli $ amplify configure

    region と username 聞かれるので⼊⼒ ブラウザで IAM ユーザーの作成が求められるので作る 7 7
  5. 8 8

  6. Set up fullstack project $ npx create-react-app react-amplified --typescript $

    cd react-amplified 今回は React の例 TypeScript は義務(過激派) 他にも Angular や iOS など主要なものは対応されてる 10 10
  7. Install Amplify libraries $ yarn add aws-amplify @aws-amplify/ui-react aws-amplify AWS

    との通信などが簡単にできるライブラリ @aws-amplify/ui-react ログイン画⾯などの UI 部品群 公式 には npm 使われてるけど yarn で追加してる create-react-app のデフォは yarn なので 12 12
  8. Set up frontend // src/index.tsx import Amplify from "aws-amplify"; import

    awsExports from "./aws-exports"; Amplify.configure(awsExports); Amplify に設定を⾷わせる 実態は AWS の各種サービスの ID などの設定 13 13
  9. Cognito 認証してみる $ amplify add auth $ amplify push 質問出てくるので答えると

    Cognito のセットアップが完了す る push すると AWS に反映され Cognito が出来上がる ⼀部項⽬以外は amplify update auth で後から更新可能 15 15