{"id":18248173,"url":"https://github.com/serverless-components/tencent-http","last_synced_at":"2025-08-21T18:07:54.941Z","repository":{"id":42190667,"uuid":"340316589","full_name":"serverless-components/tencent-http","owner":"serverless-components","description":"About Easily deploy serverless http framework applications to Tencent Cloud with the Serverless Framework","archived":false,"fork":false,"pushed_at":"2022-04-11T09:59:46.000Z","size":5197,"stargazers_count":14,"open_issues_count":8,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-04T15:40:04.730Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serverless-components.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}},"created_at":"2021-02-19T09:15:35.000Z","updated_at":"2024-12-31T06:25:25.000Z","dependencies_parsed_at":"2022-08-12T09:00:42.465Z","dependency_job_id":null,"html_url":"https://github.com/serverless-components/tencent-http","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/serverless-components/tencent-http","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-components%2Ftencent-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-components%2Ftencent-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-components%2Ftencent-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-components%2Ftencent-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serverless-components","download_url":"https://codeload.github.com/serverless-components/tencent-http/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless-components%2Ftencent-http/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271518070,"owners_count":24773812,"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","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-11-05T09:36:09.469Z","updated_at":"2025-08-21T18:07:54.525Z","avatar_url":"https://github.com/serverless-components.png","language":"TypeScript","readme":"## 腾讯云 HTTP 框架组件\n\n通过使用 [Tencent Serverless](https://github.com/serverless/components/tree/cloud)，基于云上 Serverless 服务（如网关、云函数等），实现便捷开发，极速部署你的 Web 框架应用，组件支持丰富的配置扩展，提供了目前最易用、低成本并且弹性伸缩的 Web 框架项目开发/托管能力。\n\n特性介绍：\n\n- [x] **按需付费** - 按照请求的使用量进行收费，没有请求时无需付费\n- [x] **极速部署** - 仅需几秒，部署你的整个 Web 框架应用。\n- [x] **实时日志** - 通过实时日志的输出查看业务状态，便于直接在云端开发应用。\n- [x] **云端调试** - 针对 Node.js 框架支持一键云端调试能力，屏蔽本地环境的差异。\n- [x] **便捷协作** - 通过云端的状态信息和部署日志，方便的进行多人协作开发。\n- [x] **自定义域名** - 支持配置自定义域名及 HTTPS 访问\n\n## 示例代码\n\n项目 [examples](./examples) 目录下存放了支持框架的实例代码，可以之类进入到指定框架目录执行部署\n\n## 快速开始\n\n1. [**安装**](#1-安装)\n2. [**创建**](#2-创建)\n3. [**配置**](#3-配置)\n4. [**部署**](#4-部署)\n5. [**查看状态**](#5-查看状态)\n6. [**移除**](#6-移除)\n\n更多资源：\n\n- [**架构说明**](#架构说明)\n- [**账号配置**](#账号配置)\n\n### 1. 安装\n\n通过 npm 安装最新版本的 Serverless CLI\n\n```bash\n$ npm install -g serverless\n```\n\n\u003e 注意：如果项目目录下存在 `sls.js`，`Windows` 系统会默认执行 `sls.js` 脚本文件，此时建议 `Windows` 用户不要使用 `sls` 简写命令。\n\n### 2. 创建项目\n\n快速创建一个 Express 应用：\n\n```bash\n$ mkdir serverless-express\n$ cd serverless-express\n```\n\n新建 `app.js` 文件：\n\n```js\nconst express = require('express');\nconst path = require('path');\nconst app = express();\n\n// Routes\napp.get(`/`, (req, res) =\u003e {\n  res.send([\n    {\n      title: 'serverless framework',\n      link: 'https://serverless.com',\n    },\n  ]);\n});\n\napp.listen(9000, () =\u003e {\n  console.log(`Server start on http://localhost:9000`);\n});\n```\n\n安装 `express` 依赖：\n\n```bash\n$ npm install express --save\n```\n\n### 3. 配置\n\n在项目根目录添加配置文件 `serverless.yml`，如下所示：\n\n```yml\n# serverless.yml\ncomponent: http\nname: expressDemo\n\ninputs:\n  src:\n    src: ./\n  region: ap-guangzhou\n  faas:\n    framework: express\n    name: expressDemo\n  apigw:\n    protocols:\n      - http\n      - https\n```\n\n点此查看[全量配置及配置说明](./docs/configure.md)\n\n### 4. 部署\n\n在 `serverless.yml` 文件所在的项目根目录，运行以下指令进行部署：\n\n```bash\n$ sls deploy\n```\n\n部署时需要进行身份验证，如您的账号未 [登陆](https://cloud.tencent.com/login) 或 [注册](https://cloud.tencent.com/register) 腾讯云，您可以直接通过 `微信` 扫描命令行中的二维码进行授权登陆和注册。\n\n\u003e 注意: 如果希望查看更多部署过程的信息，可以通过 `sls deploy --debug` 命令查看部署过程中的实时日志信息。\n\n部署完成后，控制台会打印相关的输出信息，您可以通过 `${output:${stage}:${app}:apigw.url}` 的形式在其他 `serverless` 组件中引用该组件的 API 网关访问链接（或通过类似的形式引用该组建其他输出结果），具体的，可以查看完成的输出文档：\n\n- [点击此处查看输出文档](./docs/output.md)\n\n### 5. 查看状态\n\n在`serverless.yml`文件所在的目录下，通过如下命令查看部署状态：\n\n```\n$ serverless info\n```\n\n### 6. 移除\n\n在`serverless.yml`文件所在的目录下，通过以下命令移除部署的 Express 服务。移除后该组件会对应删除云上部署时所创建的所有相关资源。\n\n```\n$ serverless remove\n```\n\n和部署类似，支持通过 `serverless remove --debug` 命令查看移除过程中的实时日志信息。\n\n## 架构说明\n\nWeb 框架组件将在腾讯云账户中使用到如下 Serverless 服务：\n\n- [x] **API 网关** - API 网关将会接收外部请求并且转发到 SCF 云函数中。\n- [x] **SCF 云函数** - 云函数将承载 Web 框架应用。\n- [x] **CAM 访问控制** - 该组件会创建默认 CAM 角色用于授权访问关联资源。\n- [x] **COS 对象存储** - 为确保上传速度和质量，云函数压缩并上传代码时，会默认将代码包存储在特定命名的 COS 桶中。\n- [x] **SSL 证书服务** - 如果你在 yaml 文件中配置了 `apigw.customDomains` 字段，需要做自定义域名绑定并开启 HTTPS 时，也会用到证书管理服务和域名服务。Serverless Framework 会根据已经备案的域名自动申请并配置 SSL 证书。\n\n## 账号配置\n\n当前默认支持 CLI 扫描二维码登录，如您希望配置持久的环境变量/秘钥信息，也可以本地创建 `.env` 文件\n\n```console\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## 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-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserverless-components%2Ftencent-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverless-components%2Ftencent-http/lists"}