Skip to content

Commit

Permalink
feat: add some texts
Browse files Browse the repository at this point in the history
  • Loading branch information
crazywoolala committed Jul 9, 2024
1 parent cace153 commit ea3a588
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 4 deletions.
Binary file modified .DS_Store
Binary file not shown.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,13 @@

This is an example of using Cloudflare Workers to create a simple API that store and retrieve data from D1 storage.

[Basic Template](./docs/basic.md)
[Global Storage](./docs/global_store.md)
For basic usage, you can use the [Basic Template](./docs/basic.md).

```
git checkout v1.0
```

For more advanced usage, you can use the [Global Storage](./docs/global_store.md)



Binary file added assets/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 42 additions & 2 deletions docs/global_store.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,44 @@

### Quick Start

https://developers.cloudflare.com/d1/get-started
You will get a url like this: https://difytoolsworker.yourname.workers.dev

#### Worker
#### Step 0
In Dify tools, you can create a new custom tool and use the `https://difytoolsworker.yourname.workers.dev/doc` as the endpoint.

#### Step 1

Click import from URL you deployed from Cloudflare Workers.

<img src="../assets/3.png" width="500">

#### Step 2

Set the Authorization header with the token you set in the wrangler.toml file. Mine is `bananaiscool`.

<img src="../assets/4.png" width="500">

#### Step 3

Click Save and you are done.

### Step 4

You can now use the tool in Dify Workflows.

Not Found

<img src="../assets/5.png" width="500">

Found

<img src="../assets/6.png" width="500">

In D1 Console

<img src="../assets/7.png" width="500">

### Development
```
npm install
cp wrangler.toml.example wrangler.toml
Expand Down Expand Up @@ -54,3 +89,8 @@ npx wrangler d1 migrations list <DATABASE_NAME> --local
```
npm run deploy
```

## References

[Cloudflare Workers](https://developers.cloudflare.com/workers/)
[D1](https://developers.cloudflare.com/workers/cli-wrangler/commands/d1)

0 comments on commit ea3a588

Please sign in to comment.