Skip to content

Commit 8f9b09b

Browse files
renebrandelR L Naborsjosefaidtsiegerts
authored
Updated Vanilla JS getting started guide (aws-amplify#4674)
* Updated Vanilla JS getting started guide * Update src/fragments/start/getting-started/vanillajs/setup.mdx Co-authored-by: josef <[email protected]> * Update src/fragments/start/getting-started/vanillajs/data-model.mdx Co-authored-by: josef <[email protected]> * Update src/fragments/start/getting-started/vanillajs/data-model.mdx Co-authored-by: siegerts <[email protected]> Co-authored-by: R L Nabors <[email protected]> Co-authored-by: josef <[email protected]> Co-authored-by: siegerts <[email protected]>
1 parent dd51f43 commit 8f9b09b

File tree

4 files changed

+44
-51
lines changed

4 files changed

+44
-51
lines changed
177 KB
Loading

src/fragments/start/getting-started/vanillajs/data-model.mdx

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,13 @@ 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:
18+
? Select from one of the below mentioned services:
1919
# GraphQL
20-
? Provide API name:
21-
# amplifyjsapp
22-
? Choose the default authorization type for the API:
23-
# API Key
24-
? Enter a description for the API key:
25-
# todos
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
20+
? Here is the GraphQL API that we will create. Select a setting to edit or continue
21+
# Continue
3222
? Choose a schema template:
3323
# Single object with fields (e.g., “Todo” with ID, name, description)
34-
? Do you want to edit the schema now?
24+
Do you want to edit the schema now? (Y/n)
3525
# Yes
3626
```
3727

@@ -40,32 +30,37 @@ The CLI should open this GraphQL schema in your text editor.
4030
__amplify/backend/api/amplifyjsapp/schema.graphql__
4131

4232
```graphql
33+
# This "input" configures a global authorization rule to enable public access to
34+
# all models in this schema. Learn more about authorization rules here: https://docs.amplify.aws/cli/graphql/authorization-rules
35+
input AMPLIFY { globalAuthRule: AuthRule = { allow: public } } # FOR TESTING ONLY!
36+
4337
type Todo @model {
4438
id: ID!
4539
name: String!
4640
description: String
4741
}
42+
4843
```
4944

50-
The schema generated is for a Todo app. You'll notice a directive on the `Todo` type of `@model`. This directive is part of the [GraphQL transform](/cli/graphql/data-modeling) library of Amplify.
45+
The schema generated is for a Todo app. You'll notice a `@model` directive on the `Todo` type. This directive is part of the [GraphQL transformer](/cli/graphql/data-modeling) feature of the Amplify CLI.
5146

52-
The GraphQL Transform Library provides custom directives you can use in your schema that allow you to do things like define data models, set up authentication and authorization rules, configure serverless functions as resolvers, and more.
47+
The GraphQL transformer provides custom GraphQL directives that allow you to define data models, set up authorization rules, configure serverless functions as resolvers, and more.
5348

54-
A type decorated with the `@model` directive will scaffold out the database table for the type (Todo table), the schema for CRUD (create, read, update, delete) and list operations, and the GraphQL resolvers needed to make everything work together.
49+
A GraphQL type decorated with the `@model` directive will scaffold out the database table for the type (Todo table), the schema for CRUD (create, read, update, delete) and list operations, and the GraphQL resolvers needed to make everything work together.
5550

5651
From the command line, press __enter__ to accept the schema and continue to the next steps.
5752

5853
## Deploy your GraphQL API
5954

60-
Now that the API has been successfully created. We need to push our updated configuration to the cloud so our API can be deployed:
55+
Now that the API has been successfully created locally, you need to deploy the API to the cloud:
6156

6257
```bash
6358
amplify push
6459
```
6560

6661
## Generate code for the GraphQL API
6762

68-
When you run `amplify push`, you will be presented with the option to have all the GraphQL operations found in your schema generated for you in code. Choose the following options:
63+
When you run `amplify push`, you can generate client code for all the GraphQL operations (create, read, update, delete, list). These client code snippets allow you to execute these GraphQL operations more easily with the help of the Amplify JavaScript library. Choose the following options:
6964

7065
```console
7166
? Do you want to generate code for your newly created GraphQL API (Yes)
@@ -226,4 +221,4 @@ Now if you wish to subscribe to data, import the `onCreateTodo` subscription and
226221
getData();
227222
```
228223

229-
After restarting your app using `npm start` go back to your browser and using dev tools you will see data being stored and retrieved in your backend from the console logs.
224+
After restarting your app using `npm start` go back to your browser and you will see subscription events displayed under **Subscription Results**.

src/fragments/start/getting-started/vanillajs/hosting.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
You've successfully built your first app with Amplify! Now that you've built something, it's time to deploy it to the web with Amplify Console!
1+
You've successfully built your first app with Amplify! Now that you've built something, it's time to deploy it to the web with Amplify Hosting!
22

33
## Add hosting to your app
44
You can manually deploy your web app or setup automatic continuous deployment. In this guide we'll cover how to manually deploy and host your static web app to quickly share with others. If you want to learn about continuous deployment instead, please follow [this guide](https://docs.aws.amazon.com/amplify/latest/userguide/multi-environments.html#standard).
@@ -23,12 +23,12 @@ amplify publish
2323

2424
👏 Congratulations, your app is online!
2525

26-
![image](/images/browser-published-updated.png)
26+
![image](/images/browser-vanillajs-hosting.png)
2727

2828
After publishing, your terminal will display your app URL hosted on a `amplifyapp.com` domain. Whenever you have additional changes to publish, just re-run the `amplify publish` command.
2929

30-
You may get an "AccessDenied" error if your app's distribution directory is not set properly. To fix this, change the distribution directory via `amplify configure project` and then re-run `amplify publish`.
30+
> You may get an "AccessDenied" error if your app's distribution directory is not set properly. To fix this, change the distribution directory via `amplify configure project` and then re-run `amplify publish`.
3131
3232
To view your app and hosting configuration in the Amplify Console, run the `amplify console` command.
3333

34-
Note: In order to delete all the environments of the project from the cloud and wipe out all the local files created by Amplify CLI, run `amplify delete` command. Now, to observe that your Amplify project resources have been deleted, run `amplify status` command.
34+
Note: To delete all the environments of the project from the cloud and wipe out all the local files created by Amplify CLI, run `amplify delete` command.

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

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -195,35 +195,33 @@ amplify init
195195
When you initialize Amplify you'll be prompted for some information about the app:
196196

197197
```console
198-
Enter a name for the project (amplifyjsapp)
199-
200-
# All AWS services you provision for your app are grouped into an "environment"
201-
# A common naming convention is dev, staging, and production
202-
Enter a name for the environment (dev)
203-
204-
# Sometimes the CLI will prompt you to edit a file, it will use this editor to open those files.
205-
Choose your default editor
206-
207-
# Amplify supports JavaScript (Web & React Native), iOS, and Android apps
208-
Choose the type of app that you're building (javascript)
209-
210-
What JavaScript framework are you using (none)
211-
212-
Source directory path (src)
213-
214-
Distribution directory path (dist)
215-
216-
Build command (npm run-script build)
217-
218-
Start command (npm run-script start)
219-
220-
# This is the profile you created with the `amplify configure` command in the introduction step.
221-
Do you want to use an AWS profile
198+
? Enter a name for the project: amplifyjsapp
199+
The following configuration will be applied:
200+
201+
Project information
202+
| Name: amplifyjsapp
203+
| Environment: dev
204+
| Default editor: Visual Studio Code
205+
| App type: javascript
206+
| Javascript framework: none
207+
| Source Directory Path: src
208+
| Distribution Directory Path: dist
209+
| Build Command: npm run-script build
210+
| Start Command: npm run-script start
211+
212+
? Initialize the project with the above configuration? Yes
213+
Using default provider awscloudformation
214+
? Select the authentication method you want to use: AWS profile
215+
216+
For more information on AWS Profiles, see:
217+
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html
218+
219+
? Please choose the profile you want to use: default
222220
```
223221

224222
When you initialize a new Amplify project, a few things happen:
225223

226-
- It creates a top level directory called `amplify` that stores your backend definition. During the tutorial you'll add capabilities such as authentication, GraphQL API, storage, and set up authorization rules for the API. As you add features, the `amplify` folder will grow with infrastructure-as-code templates that define your backend stack. Infrastructure-as-code is a best practice way to create a replicable backend stack.
227-
- It creates a file called `aws-exports.js` in the `src` directory that holds all the configuration for the services you create with Amplify. This is how the Amplify client is able to get the necessary information about your backend services.
224+
- It creates a top level directory called `amplify` that stores your backend definition. During the tutorial you'll add cloud capabilities, such as GraphQL API and web hosting. As you add these features, the `amplify` folder will grow with infrastructure-as-code templates that define your backend stack. Infrastructure-as-code is a best practice way to create a replicable backend stack.
225+
- It creates a file called `aws-exports.js` in the `src` directory that holds all the configuration for the services you create with Amplify. This is how the Amplify JavaScript client library is able to get the necessary information to connect to your backend services.
228226
- It modifies the `.gitignore` file, adding some generated files to the ignore list
229-
- A cloud project is created for you in the AWS Amplify Console that can be accessed by running `amplify console`. The Console provides a list of backend environments, deep links to provisioned resources per Amplify category, status of recent deployments, and instructions on how to promote, clone, pull, and delete backend resources
227+
- An Amplify project is created for you that can be accessed within the AWS Console by running `amplify console`. The AWS Amplify console provides a list of backend environments, deep links to provisioned resources per Amplify category, deployment statuses, and instructions on how to promote, clone, pull, and delete backend resources.

0 commit comments

Comments
 (0)