-
Notifications
You must be signed in to change notification settings - Fork 0
/
React + AWS amplify
119 lines (71 loc) · 2.2 KB
/
React + AWS amplify
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
Terminal:
=====================================================================
=====================================================================
Configure AWS Amplify CLI
% sudo npm install -g @aws-amplify/cli
password:
=====================================================================
=====================================================================
% amplify
% amplify Configure
Enter
Region - Enter
user name - give name
[ Make a copy of access key and secret key ]
Access Key :
Secret Key:
Profile Name: amplify (just a name)
=====================================================================
=====================================================================
% npx create-react-app application name(eg: Kineteco)
% cd Kineteco
# interact react with amplify
% amplify init
Enter
Enter (dev env)
VS code
js
react
Y
(choose Profile we create eg amplify)
=====================================================================
=====================================================================
% cd kineteco
% npm run start
ctrl+c
=====================================================================
=====================================================================
# go to index.js
import Amplify from 'aws-amplify';
import awsconfig from '/aws-exports';
Amplify.configure(awsconfig);
% cd kineteco
% sudo npm install aws-amplify @aws-amplify/ui-react
password:
% npm run start
=====================================================================
=====================================================================
AWS COgnito:
kineteco % ammplify add auth
Email
No,
kineteco % amplify push
yes
kineteco % amplify status
=====================================================================
=====================================================================
# App.js:
import {withAuthenticator,AmplifySignOut} from "@aws-amplify/ui-react";
export default withAuthenticator(App);
kineteco % npm run start
=====================================================================
=====================================================================
kineteco % amplify add api
GraphQl
Amazon Cognito User Pool
No
No
No
kineteco % amplify status
kineteco % amplify push
Y