{"id":24756940,"url":"https://github.com/visini/cloudflare-workers-typescript-cors","last_synced_at":"2026-04-30T00:37:48.533Z","repository":{"id":113077761,"uuid":"480906054","full_name":"visini/cloudflare-workers-typescript-cors","owner":"visini","description":null,"archived":false,"fork":false,"pushed_at":"2022-04-12T17:20:21.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-28T14:44:57.040Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/visini.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-12T17:18:58.000Z","updated_at":"2022-04-12T18:05:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"2fb113e2-7d31-4372-8707-f26a25069c46","html_url":"https://github.com/visini/cloudflare-workers-typescript-cors","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visini%2Fcloudflare-workers-typescript-cors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visini%2Fcloudflare-workers-typescript-cors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visini%2Fcloudflare-workers-typescript-cors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visini%2Fcloudflare-workers-typescript-cors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/visini","download_url":"https://codeload.github.com/visini/cloudflare-workers-typescript-cors/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245072254,"owners_count":20556353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-28T14:34:28.765Z","updated_at":"2026-04-30T00:37:48.506Z","avatar_url":"https://github.com/visini.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# esbuild-typescript-modules-workers-with-cors\n\nSee https://github.com/codewithkristian/esbuild-typescript-modules-workers-template\n\nThis adds support for:\n\n- CORS\n- Routing via `itty-router`\n\n## Install\n\n- Run `yarn`\n- Develop via `make dev` (see `wrangler.toml`) and publish via `wrangler publish`\n\n## Test CORS for GET\n\nExample: Run below in Safari dev console while on `https://dash.cloudflare.com`\n\n```js\nconst WORKER_URL = \"https://foo-worker.workers.dev\"\nconst API_KEY = \"SECRET\"\n\nawait fetch(WORKER_URL + \"/foo\", {\n  method: \"GET\",\n  mode: \"cors\",\n  headers: { \"Content-type\": \"application/json\", \"X-API-KEY\": API_KEY },\n}).then((r) =\u003e r.json())\n```\n\n## Test CORS for POST\n\nExample: Run below in Safari dev console while on `https://dash.cloudflare.com`\n\n```js\nconst WORKER_URL = \"https://foo-worker.workers.dev\"\nconst API_KEY = \"SECRET\"\n\nawait fetch(WORKER_URL + \"/foo\", {\n  method: \"POST\",\n  mode: \"cors\",\n  body: JSON.stringify({ foo: \"bar\" }),\n  headers: {\n    \"Content-type\": \"application/json\",\n    \"X-API-KEY\": API_KEY,\n  },\n}).then((r) =\u003e r.json())\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisini%2Fcloudflare-workers-typescript-cors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvisini%2Fcloudflare-workers-typescript-cors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisini%2Fcloudflare-workers-typescript-cors/lists"}