{"id":18265649,"url":"https://github.com/colorfulcat/ddhm","last_synced_at":"2025-04-09T01:45:35.893Z","repository":{"id":83463415,"uuid":"90650931","full_name":"ColorfulCat/ddhm","owner":"ColorfulCat","description":"test","archived":false,"fork":false,"pushed_at":"2023-02-18T09:02:24.000Z","size":300,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-14T20:31:51.841Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ColorfulCat.png","metadata":{"files":{"readme":"README.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-08T16:44:32.000Z","updated_at":"2023-02-18T09:02:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"ba29005a-187c-4f8c-8a11-97870ed9cdc0","html_url":"https://github.com/ColorfulCat/ddhm","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/ColorfulCat%2Fddhm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ColorfulCat%2Fddhm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ColorfulCat%2Fddhm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ColorfulCat%2Fddhm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ColorfulCat","download_url":"https://codeload.github.com/ColorfulCat/ddhm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247958733,"owners_count":21024827,"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-11-05T11:19:17.033Z","updated_at":"2025-04-09T01:45:35.877Z","avatar_url":"https://github.com/ColorfulCat.png","language":"JavaScript","readme":"# wxcloudrun-express\n\n[![GitHub license](https://img.shields.io/github/license/WeixinCloud/wxcloudrun-express)](https://github.com/WeixinCloud/wxcloudrun-express)\n![GitHub package.json dependency version (prod)](https://img.shields.io/github/package-json/dependency-version/WeixinCloud/wxcloudrun-express/express)\n![GitHub package.json dependency version (prod)](https://img.shields.io/github/package-json/dependency-version/WeixinCloud/wxcloudrun-express/sequelize)\n\n微信云托管 Node.js Express 框架模版，实现简单的计数器读写接口，使用云托管 MySQL 读写、记录计数值。\n\n![](https://qcloudimg.tencent-cloud.cn/raw/be22992d297d1b9a1a5365e606276781.png)\n\n## 快速开始\n\n前往 [微信云托管快速开始页面](https://cloud.weixin.qq.com/cloudrun/onekey)，选择相应语言的模板，根据引导完成部署。\n\n## 本地调试\n下载代码在本地调试，请参考[微信云托管本地调试指南](https://developers.weixin.qq.com/miniprogram/dev/wxcloudrun/src/guide/debug/)\n\n## 实时开发\n代码变动时，不需要重新构建和启动容器，即可查看变动后的效果。请参考[微信云托管实时开发指南](https://developers.weixin.qq.com/miniprogram/dev/wxcloudrun/src/guide/debug/dev.html)\n\n## Dockerfile最佳实践\n请参考[如何提高项目构建效率](https://developers.weixin.qq.com/miniprogram/dev/wxcloudrun/src/scene/build/speed.html)\n\n## 项目结构说明\n\n```\n.\n├── Dockerfile\n├── README.md\n├── container.config.json\n├── db.js\n├── index.js\n├── index.html\n├── package.json\n```\n\n- `index.js`：项目入口，实现主要的读写 API\n- `db.js`：数据库相关实现，使用 `sequelize` 作为 ORM\n- `index.html`：首页代码\n- `package.json`：Node.js 项目定义文件\n- `container.config.json`：模板部署「服务设置」初始化配置（二开请忽略）\n- `Dockerfile`：容器配置文件\n\n## 服务 API 文档\n\n### `GET /api/count`\n\n获取当前计数\n\n#### 请求参数\n\n无\n\n#### 响应结果\n\n- `code`：错误码\n- `data`：当前计数值\n\n##### 响应结果示例\n\n```json\n{\n  \"code\": 0,\n  \"data\": 42\n}\n```\n\n#### 调用示例\n\n```\ncurl https://\u003c云托管服务域名\u003e/api/count\n```\n\n### `POST /api/count`\n\n更新计数，自增或者清零\n\n#### 请求参数\n\n- `action`：`string` 类型，枚举值\n  - 等于 `\"inc\"` 时，表示计数加一\n  - 等于 `\"clear\"` 时，表示计数重置（清零）\n\n##### 请求参数示例\n\n```\n{\n  \"action\": \"inc\"\n}\n```\n\n#### 响应结果\n\n- `code`：错误码\n- `data`：当前计数值\n\n##### 响应结果示例\n\n```json\n{\n  \"code\": 0,\n  \"data\": 42\n}\n```\n\n#### 调用示例\n\n```\ncurl -X POST -H 'content-type: application/json' -d '{\"action\": \"inc\"}' https://\u003c云托管服务域名\u003e/api/count\n```\n\n## 使用注意\n如果不是通过微信云托管控制台部署模板代码，而是自行复制/下载模板代码后，手动新建一个服务并部署，需要在「服务设置」中补全以下环境变量，才可正常使用，否则会引发无法连接数据库，进而导致部署失败。\n- MYSQL_ADDRESS\n- MYSQL_PASSWORD\n- MYSQL_USERNAME\n以上三个变量的值请按实际情况填写。如果使用云托管内MySQL，可以在控制台MySQL页面获取相关信息。\n\n\n## License\n\n[MIT](./LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolorfulcat%2Fddhm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcolorfulcat%2Fddhm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolorfulcat%2Fddhm/lists"}