Skip to content

Commit f62adda

Browse files
R L Naborssiegerts
andauthored
Getting Started Tutorial : React update (aws-amplify#4676)
* clarifying this needs a new terminal * updates * Update src/fragments/start/getting-started/common/prereq.mdx Co-authored-by: siegerts <[email protected]> * Update src/fragments/start/getting-started/react/api.mdx Co-authored-by: siegerts <[email protected]> * updating per review Co-authored-by: siegerts <[email protected]>
1 parent 39137a1 commit f62adda

File tree

15 files changed

+264
-111
lines changed

15 files changed

+264
-111
lines changed

amplify/cli.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,8 @@
4949
"project": {
5050
"overrides": true
5151
}
52+
},
53+
"debug": {
54+
"shareProjectConfig": false
5255
}
5356
}

cspell.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
"AbortIncompleteMultipartUpload",
4343
"accesskey",
4444
"accessKey",
45+
"ACCESSKEYID",
46+
"ACCESSKEY",
4547
"AccessToken",
4648
"AccountRepresentative",
4749
"ACLs",
@@ -844,6 +846,7 @@
844846
"myAmplifyProject",
845847
"myangularapp",
846848
"myapi",
849+
"reactamplified",
847850
"myapp.xcodeproj",
848851
"myapp",
849852
"mybucket",

src/fragments/start/getting-started/angular/setup.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ import 'core-js/es/object';
3131

3232
## Create a new Amplify backend
3333

34-
Now that we have a running Angular app, it's time to set up Amplify for this app so that we can create the necessary backend services needed to support the app. From the root of the project, run:
34+
Now that we have a running Angular app, it's time to set up Amplify for this app so that we can create the necessary backend services needed to support the app.
35+
36+
Open a new terminal. From the root of the project, run:
3537

3638
```bash
3739
amplify init
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
🙌 Great job! You have successfully deployed your API and connected it with your app!
1+
You have successfully deployed your API and connected it to your app!

src/fragments/start/getting-started/common/prereq.mdx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
Before we begin, make sure you have the following installed:
1+
Before you begin, make sure you have the following installed:
22

33
- [Node.js](https://nodejs.org/) v14.x or later
4-
54
- [npm](https://www.npmjs.com/) v6.14.4 or later
6-
75
- [git](https://git-scm.com/) v2.14.1 or later
86

97
import flutter1 from '/src/fragments/start/getting-started/flutter/prereq.mdx';
@@ -61,26 +59,26 @@ Once you're signed in, Amplify CLI will ask you to create an IAM user.
6159
6260
```console
6361
Specify the AWS Region
64-
? region: # Your preferred region
62+
? region: <Your preferred region>
6563
Specify the username of the new IAM user:
66-
? user name: # User name for Amplify IAM user
67-
Complete the user creation using the AWS console
64+
? user name: <User name for Amplify IAM user>
65+
Complete the user creation using the AWS console: <URL>
6866
```
6967

70-
Create a user with `AdministratorAccess-Amplify` to your account to provision AWS resources for you like AppSync, Cognito etc.
68+
Follow the `<URL>` and create a user with `AdministratorAccess-Amplify` to your account to provision AWS resources for you like AppSync, Cognito etc.
7169

7270
![image](/images/user-creation.gif)
7371

74-
Once the user is created, Amplify CLI will ask you to provide the `accessKeyId` and the `secretAccessKey` to connect Amplify CLI with your newly created IAM user.
72+
Amplify CLI will then ask you to copy and paste the `accessKeyId` and the `secretAccessKey` from your newly created IAM user to connect with Amplify CLI.
7573

7674
```console
7775
Enter the access key of the newly created user:
78-
? accessKeyId: # YOUR_ACCESS_KEY_ID
79-
? secretAccessKey: # YOUR_SECRET_ACCESS_KEY
76+
? accessKeyId: <ACCESSKEYID>
77+
? secretAccessKey: <ACCESSKEY>
8078
This would update/create the AWS Profile in your local machine
81-
? Profile Name: # (default)
79+
? Profile Name: default
80+
```
8281

8382
Successfully set up the new user.
84-
```
8583

86-
Next, we'll set up the app and initialize Amplify!
84+
In the next section, you'll set up the app and initialize Amplify.

src/fragments/start/getting-started/ionic/setup.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ This runs a development server and allows us to see the output generated by the
1313

1414
## Initialize a new backend
1515

16-
Now that we have a running Ionic app, it's time to set up Amplify so that we can create the necessary backend services needed to support the app. From the root of the project, run:
16+
Now that we have a running Ionic app, it's time to set up Amplify so that we can create the necessary backend services needed to support the app.
17+
18+
Open a new terminal. From the root of the project, run:
1719

1820
```bash
1921
amplify init

src/fragments/start/getting-started/next/setup.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This runs a development server and allows us to see the output generated by the
2121

2222
Now that we have a running Next.js app, it's time to set up Amplify so that we can create the necessary backend services needed to support the app.
2323

24-
From the root of the project, run:
24+
Open a new terminal. From the root of the project, run:
2525

2626
```bash
2727
amplify init

src/fragments/start/getting-started/react/api.mdx

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,9 @@ amplify add api
1515
Accept the **default values** which are highlighted below:
1616

1717
```console
18-
? Please select from one of the below mentioned services:
19-
# GraphQL
20-
? Provide API name:
21-
# myapi
22-
? Choose the default authorization type for the API:
23-
# API Key
24-
? Enter a description for the API key:
25-
# demo
26-
? After how many days from now the API key should expire:
27-
# 7 (or your preferred expiration)
28-
? Do you want to configure advanced settings for the GraphQL API:
29-
# No
30-
? Do you have an annotated GraphQL schema?
31-
# No
32-
? Choose a schema template:
33-
# Single object with fields (e.g., “Todo” with ID, name, description)
34-
? Do you want to edit the schema now?
35-
# Yes
18+
? Select from one of the below mentioned services: GraphQL
19+
? Here is the GraphQL API that we will create. Select a setting to edit or continue Continue
20+
? Choose a schema template: Single object with fields (e.g., “Todo” with ID, name, description)
3621
```
3722

3823
The CLI should open this GraphQL schema in your text editor.
@@ -74,6 +59,18 @@ amplify push
7459
? Enter maximum statement depth [increase from default if your schema is deeply nested]: 2
7560
```
7661

62+
```console
63+
? Are you sure you want to continue? Yes
64+
65+
...
66+
67+
? Do you want to generate code for your newly created GraphQL API Yes
68+
? Choose the code generation language target javascript
69+
? Enter the file name pattern of graphql queries, mutations and subscriptions src/graphql/**/*.js
70+
? Do you want to generate/update all possible GraphQL operations - queries, mutations and subscriptions Yes
71+
? Enter maximum statement depth [increase from default if your schema is deeply nested] 2
72+
```
73+
7774
Now the API is live and you can start interacting with it!
7875

7976
The API you have deployed is for a Todo app, including operations for creating, reading, updating, deleting, and listing todos.
@@ -116,13 +113,13 @@ To test this out locally, you can run the `mock` command.
116113
amplify mock api
117114
```
118115

119-
*Note:* `amplify mock api` requires Java.
116+
*Note:* `amplify mock api` requires Java. If you have not already deployed your API with `amplify push`, you will be walked through the following steps for GraphQL code generation.
120117

121118
```console
122-
# If you have not already deployed you API, you will be walked through the following steps for GraphQL code generation
123-
? Choose the code generation language target: javascript (or preferred target)
124-
? Enter the file name pattern of graphql queries, mutations and subscriptions: src/graphql/**/*.js
125-
? Do you want to generate/update all possible GraphQL operations - queries, mutations and subscriptions: Yes
119+
? Do you want to generate code for your newly created GraphQL API Yes
120+
? Choose the code generation language target javascript
121+
? Enter the file name pattern of graphql queries, mutations and subscriptions src/graphql/**/*.js
122+
? Do you want to generate/update all possible GraphQL operations - queries, mutations and subscriptions Yes
126123
? Enter maximum statement depth [increase from default if your schema is deeply nested] 2
127124
```
128125

@@ -245,7 +242,7 @@ export default App
245242

246243
Let's walk through some of the functions:
247244

248-
__useEffect__ - When the component loads, the `useEffect` hook is called and it invokes the `fetchTodos` function.
245+
__useEffect__ - After the component renders, the `useEffect` hook is called and it invokes the `fetchTodos` function.
249246

250247
__fetchTodos__ - Uses the Amplify `API` category to call the AppSync GraphQL API with the `listTodos` query. Once the data is returned, the items array is passed in to the `setTodos` function to update the local state.
251248

0 commit comments

Comments
 (0)