{"id":21863112,"url":"https://github.com/shfshanyue/serverless-http","last_synced_at":"2026-04-11T03:04:30.886Z","repository":{"id":41657748,"uuid":"258763653","full_name":"shfshanyue/serverless-http","owner":"shfshanyue","description":"Serverless Http Component for Tencent Cloud","archived":false,"fork":false,"pushed_at":"2023-01-06T04:23:41.000Z","size":1820,"stargazers_count":2,"open_issues_count":20,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-26T15:13:47.829Z","etag":null,"topics":["express","koa","serverless","serverless-express","serverless-function","serverless-http"],"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/shfshanyue.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":"2020-04-25T11:53:59.000Z","updated_at":"2023-05-06T09:59:21.000Z","dependencies_parsed_at":"2023-02-05T07:16:30.349Z","dependency_job_id":null,"html_url":"https://github.com/shfshanyue/serverless-http","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"serverless/template-package","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shfshanyue%2Fserverless-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shfshanyue%2Fserverless-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shfshanyue%2Fserverless-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shfshanyue%2Fserverless-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shfshanyue","download_url":"https://codeload.github.com/shfshanyue/serverless-http/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244862185,"owners_count":20522748,"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":["express","koa","serverless","serverless-express","serverless-function","serverless-http"],"created_at":"2024-11-28T03:20:04.273Z","updated_at":"2025-12-30T20:51:20.249Z","avatar_url":"https://github.com/shfshanyue.png","language":"JavaScript","readme":"# Serverless Http Component for Tencent Cloud\n\n快速在腾讯云上部署 `express` 及 `koa` 应用，并可以充分集成 `typescript`，`babel` 等转译工具。本工具基于腾讯云的 [tencent-framework](https://github.com/serverless-components/tencent-framework)\n\n## 快速开始\n\n根据我的模板进行创建，这是一个简单结合 `koa` 及 `typescript` 的示例。关于本示例使用请移至 [tencent-koa-ts](https://github.com/shfshanyue/serverless-template-zh/tree/master/tencent-koa-ts)\n\n```bash\n$ serverless install --url https://github.com/shfshanyue/serverless-template-zh/tree/master/tencent-koa-ts --name koa-function\n```\n\n## 部署到腾讯云\n\n```bash\n# 部署到腾讯云\n$ sls\nkoa-function [████████████████████████████████████████] 100% | ETA: 0s | Speed: 314.98k/\n\n  koa-app:\n    functionName:        koa-function\n    functionOutputs:\n      ap-guangzhou:\n        Name:        koa-function\n        Runtime:     Nodejs10.15\n        Handler:     http-handler.handler\n        MemorySize:  128\n        Timeout:     60\n        Region:      ap-guangzhou\n        Namespace:   default\n        Description: This is a function created by serverless component\n    region:              ap-guangzhou\n    apiGatewayServiceId: service-dture22u\n    url:                 https://service-dture22u-1257314149.gz.apigw.tencentcs.com/release/\n    cns:                 (empty array)\n\n  11s › koa-app › done\n```\n\n## 自定义配置\n\n```yaml\napp:\n  component: sls-component-http\n  inputs:\n    region: ap-guangzhou\n    functionName: app-demo\n    runtime: Nodejs10.15\n    functionConf:\n      timeout: 60\n      memorySize: 128\n    apigatewayConf:\n      protocols:\n        - https\n      environment: release\n```\n\n更多配置参见 [tencent framework configure](https://github.com/serverless-components/tencent-framework/blob/master/docs/configure.md)\n\n## 服务器框架\n\n你可以从任意服务器框架中导出 `HttpServer` 作为入口文件，并在 `package.json` 中的 `main` 字段中标明入口文件位置。\n\n因此你可以使用任意的转译工具，如 `typescript` 及 `babel`，只需要注意在 `package.json` 中标明编译后入口文件位置。\n\n### Koa\n\n```js\nconst Koa = require('koa')\n\nconst app = new Koa()\n\napp.use((ctx) =\u003e {\n  ctx.body = 'hello, world'\n})\n\nmodule.exports = app\n```\n\n### Express\n\n```js\nconst express = require('express')\nconst app = express()\n\n// Routes\napp.get(`/*`, (req, res) =\u003e {\n  res.send('hello, world)\n})\n\nmodule.exports = app\n```\n\n## 注意点\n\n1. 如入口文件并非 `index.js`，请在 `package.json` 中 `main` 字段标明位置\n1. 严格区分 `dep` 及 `devDep`，避免在部署时因为 `node_modules` 过大而造成速度过慢\n1. 如使用 `typescript` 等编译工具，请使用 `inputs.exclude` 排除源文件及编译工具\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshfshanyue%2Fserverless-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshfshanyue%2Fserverless-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshfshanyue%2Fserverless-http/lists"}