Skip to content

Commit

Permalink
feat(docs): update docs (#546)
Browse files Browse the repository at this point in the history
feat(docs): update docs

Updates the Wing docs. See details in [workflow run].

[Workflow Run]: https://github.com/winglang/docsite/actions/runs/5617335798

------

*Automatically created via the "update-docs" workflow*
  • Loading branch information
monadabot authored Jul 21, 2023
1 parent 925dab0 commit 6c16fdb
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
12 changes: 8 additions & 4 deletions versioned_docs/version-latest/01-start-here/03-hello.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,19 @@ entrypoint of your Wing application.
bring cloud;

let bucket = new cloud.Bucket();
let counter = new cloud.Counter(
initial: 1
);
let queue = new cloud.Queue();

queue.setConsumer(inflight (message: str) => {
bucket.put("wing.txt", "Hello, ${message}");
log("file created");
let index = counter.inc();
bucket.put("wing-${index}.txt", "Hello, ${message}");
log("file wing-${index}.txt created");
});
```

This code should be mostly self explanatory. We define a queue, and every time a
message is added to the queue, a handler is triggered and creates a file named `wing.txt` with `"Hello, ${message}!"` content .
This code should be mostly self explanatory. We define a queue and a counter, and every time a
message is added to the queue, a handler is triggered and creates a file named `wing-<counter-index>.txt` with `"Hello, ${message}!"` content, and the counter is incremented by 1.

Now that we've written this program, let's run and test it using the **Wing Console**.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ On the interaction panel, Type a message in the `Push Message` text area (let's

Now, click on the bucket in the map view. Notice that the interaction panel has changed and now shows the bucket's interaction view.

When you click on the `wing.txt` file, you should be able to see its contents.
When you click on the `wing-1.txt` file, you should be able to see its contents.

![Bucket resource view in Wing Console](./console-bucket-1.png 'Bucket resource')

Expand Down
13 changes: 8 additions & 5 deletions versioned_docs/version-latest/01-start-here/05-aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ plan. Resource actions are indicated with the following symbols:

Terraform will perform the following actions:

# aws_dynamodb_table.cloudCounter will be created
+ resource "aws_dynamodb_table" "cloudCounter" {...}

# aws_iam_role.cloudQueue-SetConsumer-cdafee6e_IamRole_2548D828 will be created
+ resource "aws_iam_role" "cloudQueue-SetConsumer-cdafee6e_IamRole_2548D828" {...}

Expand Down Expand Up @@ -123,7 +126,7 @@ Terraform will perform the following actions:
# aws_sqs_queue.cloudQueue will be created
+ resource "aws_sqs_queue" "cloudQueue" {...}

Plan: 11 to add, 0 to change, 0 to destroy.
Plan: 12 to add, 0 to change, 0 to destroy.
```

> This is a good opportunity to observe how much complexity the Wing compiler
Expand All @@ -134,7 +137,7 @@ If you choose to proceed, Terraform will do its magic and will create all of the
account.

```
Apply complete! Resources: 11 added, 0 changed, 0 destroyed.
Apply complete! Resources: 12 added, 0 changed, 0 destroyed.
```

## Explore your app on AWS
Expand All @@ -149,15 +152,15 @@ through the AWS Management Console.
5. In the **Message Body** box type `cloud` and hit **Send message**.
6. Jump over to the [S3 Console](https://s3.console.aws.amazon.com/s3/buckets)
7. There should be some buckets prefixed with `cloud-bucket-`.
8. Cycle through the buckets until you find one that contains `wing.txt`.
9. Click `wing.txt` then click the `Open` button.
8. Cycle through the buckets until you find one that contains `wing-1.txt`.
9. Click `wing-1.txt` then click the `Open` button.
10. The file should contain `Hello, cloud`.

## Cleanup

Terraform doesn't allow destroying a non-empty bucket by default. To prepare for
easy cleanup, you may delete the newly created file by marking the checkbox next
to `wing.txt`, clicking the `Delete` button, typing `permanently delete` in the
to `wing-1.txt`, clicking the `Delete` button, typing `permanently delete` in the
confirmation box and clicking the `Delete objects` button.

Once you're done, you can destroy all of the resources that were created on your AWS account by running:
Expand Down
Binary file modified versioned_docs/version-latest/01-start-here/console-app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified versioned_docs/version-latest/01-start-here/console-queue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

1 comment on commit 6c16fdb

@vercel
Copy link

@vercel vercel bot commented on 6c16fdb Jul 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.