{"id":15509693,"url":"https://github.com/willin/cloudflare-pageviews-worker","last_synced_at":"2025-04-14T14:09:11.313Z","repository":{"id":147136868,"uuid":"442654306","full_name":"willin/cloudflare-pageviews-worker","owner":"willin","description":"A Simple Pageviews API using Cloudflare Worker","archived":false,"fork":false,"pushed_at":"2021-12-29T12:53:46.000Z","size":74,"stargazers_count":2,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T17:41:36.343Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://blog.csdn.net/jslygwx/article/details/122224575","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willin.png","metadata":{"files":{"readme":"README.en.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-12-29T03:56:49.000Z","updated_at":"2024-07-19T00:36:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"bde848b4-3d71-4ad4-8d7a-31d9090cbfba","html_url":"https://github.com/willin/cloudflare-pageviews-worker","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"4c0310af4a21de6ad9d96453634063b7c8aa4f56"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willin%2Fcloudflare-pageviews-worker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willin%2Fcloudflare-pageviews-worker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willin%2Fcloudflare-pageviews-worker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willin%2Fcloudflare-pageviews-worker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willin","download_url":"https://codeload.github.com/willin/cloudflare-pageviews-worker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248894939,"owners_count":21179152,"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":"2024-10-02T09:43:30.304Z","updated_at":"2025-04-14T14:09:11.286Z","avatar_url":"https://github.com/willin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cloudflare-pageviews-worker\n\n[![GitHub followers](https://img.shields.io/github/followers/willin?logo=github\u0026style=flat-square\u0026label=)](https://github.com/willin) ![GitHub forks](https://img.shields.io/github/forks/willin/cloudflare-pageviews-worker?style=flat-square)\n\n[简体中文](./README.md)\n\n## Usage\n\nFirst step, fork this repo and clone to your local directory.\n\nSencond, configure environment.\n\n```bash\n# Install command line tools\nnpm install -g @cloudflare/wrangler\n# Login Cloudflare\nwrangler login\n# Create KV Namespace\nwrangler kv:namespace create \"views\" --env production\n```\n\nOpen and edit `wrangler.toml`:\n\n- account_id\n- zone_id\n- route\n- id in kv_namespaces\n\nYou may use Github Actions to deploy automatically or manually execute `wrangler publish --env production`.\n\nAdd Secrets in your Github repo settings, and name it `CF_API_TOKEN`, value should pass in Cloudflare API Token.\n\nYou can generate an API token from: \u003chttps://dash.cloudflare.com/profile/api-tokens\u003e ,select `Edit Cloudflare Workers` to create.\n\nThen add a DNS record, A: `192.0.2.1`, Proxied.\n\n![](https://user-images.githubusercontent.com/1890238/147664047-d1240f52-2e95-4ae1-bf24-51058bbf258c.png)\n\n## API\n\n### PUT /pv?slug=optional\n\nQuery:\n\n- `slug`: string, optional\n\nif null, will return total.\n\nResults like:\n\n```js\n{\n  \"result\": {\n    \"slug\": \"total\",\n    \"pv\": 10\n  }\n}\n```\n\nP.S. Use `PUT` method (GET method will not add count).\n\n### GET /list?slugs=optional,optional\n\nQuery:\n\n- `slugs`: string, optional, join string[] with `,`\n\nif null, will return total.\n\nResult like:\n\n```js\n{\n  \"result\": [\n    {\n      \"slug\": \"total\",\n      \"pv\": 10\n    },\n    // ...\n  ]\n}\n```\n\n## LICENSE\n\nApache License 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillin%2Fcloudflare-pageviews-worker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillin%2Fcloudflare-pageviews-worker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillin%2Fcloudflare-pageviews-worker/lists"}