Skip to content

Commit

Permalink
add notes
Browse files Browse the repository at this point in the history
  • Loading branch information
victorekpo committed Jul 14, 2024
1 parent 5964633 commit 3b30a10
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
18 changes: 10 additions & 8 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
## Router

This template demonstrates using the [`itty-router`](https://github.com/kwhitley/itty-router) package to add routing to your Cloudflare Workers.
This template demonstrates using the [`itty-router`](https://github.com/kwhitley/itty-router) package to add routing to
your Cloudflare Workers.

[`index.js`](https://github.com/cloudflare/worker-template-router/blob/master/index.js) is the content of the Workers script.
[`index.js`](https://github.com/cloudflare/worker-template-router/blob/master/index.js) is the content of the Workers
script.

#### Wrangler

You can use [wrangler](https://github.com/cloudflare/wrangler) to generate a new Cloudflare Workers project based on this template by running the following command from your terminal:
You can use [wrangler](https://github.com/cloudflare/wrangler) to generate a new Cloudflare Workers project based on
this template by running the following command from your terminal:

```
wrangler generate myapp https://github.com/cloudflare/worker-template-router
```

Before publishing your code you need to edit `wrangler.toml` file and add your Cloudflare `account_id` - more information about configuring and publishing your code can be found [in the documentation](https://developers.cloudflare.com/workers/learning/getting-started#7-configure-your-project-for-deployment).
Before publishing your code you need to edit `wrangler.toml` file and add your Cloudflare `account_id` - more
information about configuring and publishing your code can be
found [in the documentation](https://developers.cloudflare.com/workers/learning/getting-started#7-configure-your-project-for-deployment).

Once you are ready, you can publish your code by running the following command:

```
wrangler publish
```

- [wrangler config](https://developers.cloudflare.com/workers/wrangler/configuration/)
- [handlebars](https://marnixkok.nl/news/blog/handlebars-templates-in-cloudflare-workers)
- [serverless rendering](https://blog.cloudflare.com/serverless-rendering-with-cloudflare-workers)

Requirements

- CLOUDFLARE_API_TOKEN must be set as an environment variable
- configure wrangler.toml accordingly with account_id and pattern for deployment domain
6 changes: 6 additions & 0 deletions client/notes/Wrangler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Wrangler Configuration - https://developers.cloudflare.com/workers/wrangler/configuration/
Routes - https://developers.cloudflare.com/workers/configuration/routing/routes/
Workers Can't fetch same worker - https://community.cloudflare.com/t/issue-with-worker-to-worker-https-request/94472/40
Service Bindings - https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/
Worker Request Headers - https://developers.cloudflare.com/fundamentals/reference/http-request-headers/
Environment Variables - https://developers.cloudflare.com/workers/configuration/environment-variables/
14 changes: 13 additions & 1 deletion client/wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ bucket = "./dist"
[build]
command = "npm run build"

[route]
[[routes]]
pattern = "**********"
custom_domain = true

[[routes]]
pattern = "**********"
custom_domain = true

[[routes]]
pattern = "**********"
custom_domain = true

[[routes]]
pattern = "**********"
custom_domain = true

0 comments on commit 3b30a10

Please sign in to comment.