{"id":13498578,"url":"https://github.com/serverless-components/tencent-koa","last_synced_at":"2026-03-02T10:32:04.868Z","repository":{"id":54834774,"uuid":"224466278","full_name":"serverless-components/tencent-koa","owner":"serverless-components","description":"Easily deploy serverless Koa applications to Tencent Cloud with the Serverless Framework ","archived":false,"fork":false,"pushed_at":"2024-10-03T08:20:48.000Z","size":164,"stargazers_count":21,"open_issues_count":0,"forks_count":10,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-10-19T21:47:35.592Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/serverless-components.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-11-27T15:55:36.000Z","updated_at":"2025-10-04T08:59:23.000Z","dependencies_parsed_at":"2024-11-05T09:38:06.154Z","dependency_job_id":"6a4abfec-127a-4026-a914-a8111168e0f1","html_url":"https://github.com/serverless-components/tencent-koa","commit_stats":{"total_commits":113,"total_committers":14,"mean_commits":8.071428571428571,"dds":"0.37168141592920356","last_synced_commit":"f14e6273f664a06b997e448498fa7b14a18f943c"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":"serverless/template-package","purl":"pkg:github/serverless-components/tencent-koa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-components%2Ftencent-koa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-components%2Ftencent-koa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-components%2Ftencent-koa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-components%2Ftencent-koa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serverless-components","download_url":"https://codeload.github.com/serverless-components/tencent-koa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-components%2Ftencent-koa/sbom","scorecard":{"id":812892,"data":{"date":"2025-08-11","repo":{"name":"github.com/serverless-components/tencent-koa","commit":"f14e6273f664a06b997e448498fa7b14a18f943c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":1,"reason":"Found 3/28 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/release.yml:1","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Warn: no topLevel permission defined: .github/workflows/validate.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/serverless-components/tencent-koa/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/serverless-components/tencent-koa/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/serverless-components/tencent-koa/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/serverless-components/tencent-koa/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/serverless-components/tencent-koa/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/serverless-components/tencent-koa/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/validate.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/serverless-components/tencent-koa/validate.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/validate.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/serverless-components/tencent-koa/validate.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/validate.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/serverless-components/tencent-koa/validate.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/release.yml:38","Warn: npmCommand not pinned by hash: .github/workflows/release.yml:39","Warn: npmCommand not pinned by hash: .github/workflows/test.yml:39","Warn: npmCommand not pinned by hash: .github/workflows/test.yml:40","Warn: npmCommand not pinned by hash: .github/workflows/validate.yml:39","Warn: npmCommand not pinned by hash: .github/workflows/validate.yml:40","Info:   0 out of   9 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   6 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 11 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T13:35:00.755Z","repository_id":54834774,"created_at":"2025-08-23T13:35:00.755Z","updated_at":"2025-08-23T13:35:00.755Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29998513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T09:59:02.300Z","status":"ssl_error","status_checked_at":"2026-03-02T09:59:02.001Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-07-31T21:00:37.105Z","updated_at":"2026-03-02T10:32:04.824Z","avatar_url":"https://github.com/serverless-components.png","language":"JavaScript","readme":"⚠️⚠️⚠️ 所有框架组件项目迁移到 [tencent-framework-components](https://github.com/serverless-components/tencent-framework-components).\n\n[![Serverless Koa Tencent Cloud](https://img.serverlesscloud.cn/20191226/1577361724216-koajs_width.png)](http://serverless.com)\n\n# 腾讯云 Koa 组件\n\n## 简介\n\n使用腾讯云 Koa 组件，可快速的在腾讯云创建，配置和管理一个 [Koa 框架](https://koajs.com/) 服务。\n\n## 目录\n\n1. [安装](#1-安装)\n2. [创建](#2-创建)\n3. [配置](#3-配置)\n4. [部署](#4-部署)\n5. [移除](#5-移除)\n\n### 1. 安装\n\n通过 npm 全局安装 [serverless cli](https://github.com/serverless/serverless)\n\n```bash\n$ npm install -g serverless\n```\n\n### 2. 创建\n\n通过如下命令和模板链接，快速创建一个 koa 应用：\n\n```bash\n$ serverless init koa-starter --name example\n$ cd example\n```\n\n### 3. 部署\n\n在 `serverless.yml` 文件所在的项目根目录，运行以下指令，将会弹出二维码，直接扫码授权进行部署：\n\n```\nserverless deploy\n```\n\n\u003e **说明**：如果鉴权失败，请参考 [权限配置](https://cloud.tencent.com/document/product/1154/43006) 进行授权。\n\n部署完成后，控制台会打印相关的输出信息，您可以通过 `${output:${stage}:${app}:apigw.url}` 的形式在其他 `serverless` 组件中引用该组件的 API 网关访问链接（或通过类似的形式引用该组建其他输出结果），具体的，可以查看完成的输出文档：\n\n- [点击此处查看输出文档](https://github.com/serverless-components/tencent-koa/tree/master/docs/output.md)\n\n### 4. 配置\n\nkoa 组件支持 0 配置部署，也就是可以直接通过配置文件中的默认值进行部署。但你依然可以修改更多可选配置来进一步开发该 koa 项目。\n\n以下是 koa 组件的 `serverless.yml`配置示例：\n\n```yml\n# serverless.yml\n\norg: orgDemo # (optional) serverless dashboard org. default is the first org you created during signup.\napp: appDemo # (optional) serverless dashboard app. default is the same as the name property.\nstage: dev # (optional) serverless dashboard stage. default is dev.\ncomponent: koa # (required) name of the component. In that case, it's koa.\nname: koaDemo # (required) name of your koa component instance.\n\ninputs:\n  src:\n    src: ./ # (optional) path to the source folder. default is a hello world app.\n    exclude:\n      - .env\n  region: ap-guangzhou\n  runtime: Nodejs10.15\n  apigatewayConf:\n    protocols:\n      - http\n      - https\n    environment: release\n```\n\n- [点击此处查看配置文档](https://github.com/serverless-components/tencent-koa/tree/master/docs/configure.md)\n\n### 5. 移除\n\n通过以下命令移除部署的 Koa 服务。\n\n```\n$ serverless remove\n```\n\n### 账号配置（可选）\n\n当前默认支持 CLI 扫描二维码登录，如您希望配置持久的环境变量/秘钥信息，也可以本地创建 `.env` 文件\n\n```bash\n$ touch .env # 腾讯云的配置信息\n```\n\n在 `.env` 文件中配置腾讯云的 SecretId 和 SecretKey 信息并保存\n\n如果没有腾讯云账号，可以在此[注册新账号](https://cloud.tencent.com/register)。\n\n如果已有腾讯云账号，可以在[API 密钥管理](https://console.cloud.tencent.com/cam/capi)中获取 `SecretId` 和`SecretKey`.\n\n```\n# .env\nTENCENT_SECRET_ID=123\nTENCENT_SECRET_KEY=123\n```\n\n## 静态资源服务\n\n如果想要支持返回静态资源，比如图片之类的，需要在入口文件 `sls.js` 中指定相关 `MIME` 类型的文件为二进制，这样云函数在返回请求结果给 API 网关是，会对指定类型进行 `Base64` 编码，最终返回给客户端才能正常显示。如下：\n\n```js\nconst koa = require('koa')\nconst app = koa()\n\n// Routes\n// ...\n\napp.binaryTypes = ['*/*']\n\nmodule.exports = app\n```\n\n`['*/*']` 代表所有文件类型将进行 `Base64` 编码，如果需要定制化，可以配置为 `['image/png']`，意思是指定 `png` 格式的图片类型。\n\n更多文件类型的 `MIME` 类型，可参考 [mime-db](https://github.com/jshttp/mime-db/blob/master/db.json)。\n\n### slsInitialize 应用初始化\n\n有些时候，Koa 服务在启动前，需要进行一个初始化操作，比如数据库建连，就可以通过在 Koa 实例对象上添加 `slsInitialize` 函数来实现，如下：\n\n```js\nconst Koa = require('koa')\nconst mysql = require('mysql2/promise')\n\nconst app = new Koa()\n\n// ...\n\napp.slsInitialize = async () =\u003e {\n  app.db = await mysql.createConnection({\n    host: 'localhost',\n    user: 'root',\n    database: 'test'\n  })\n}\n\n// don't forget to export!\nmodule.exports = app\n```\n\n这样应用部署到云函数后，在函数服务逻辑执行前，会先执行 `slsInitialize()` 函数，来初始化数据库连接。\n\n## 文件上传\n\n[文件上传教程](https://github.com/serverless-components/tencent-koa/tree/master/docs/upload.md)\n\n## License\n\nMIT License\n\nCopyright (c) 2020 Tencent Cloud, Inc.\n","funding_links":[],"categories":["组件"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverless-components%2Ftencent-koa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserverless-components%2Ftencent-koa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverless-components%2Ftencent-koa/lists"}