-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5964633
commit 3b30a10
Showing
3 changed files
with
29 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters