{"id":18918432,"url":"https://github.com/serverlessplus/js","last_synced_at":"2025-04-15T10:32:45.714Z","repository":{"id":143908353,"uuid":"178527064","full_name":"serverlessplus/js","owner":"serverlessplus","description":"serverless your express/koa/restify apps","archived":false,"fork":false,"pushed_at":"2019-08-08T03:07:53.000Z","size":23,"stargazers_count":21,"open_issues_count":0,"forks_count":5,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-28T20:05:06.378Z","etag":null,"topics":["apigateway","express","koa","restify","scf","serverless","tencent-cloud"],"latest_commit_sha":null,"homepage":"http://serverless.plus","language":"JavaScript","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/serverlessplus.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":"2019-03-30T07:32:11.000Z","updated_at":"2021-01-21T20:05:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"55eb4eb6-abea-4530-8830-36b173c531f7","html_url":"https://github.com/serverlessplus/js","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/serverlessplus%2Fjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverlessplus%2Fjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverlessplus%2Fjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverlessplus%2Fjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serverlessplus","download_url":"https://codeload.github.com/serverlessplus/js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249051833,"owners_count":21204894,"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":["apigateway","express","koa","restify","scf","serverless","tencent-cloud"],"created_at":"2024-11-08T10:31:53.951Z","updated_at":"2025-04-15T10:32:45.708Z","avatar_url":"https://github.com/serverlessplus.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](serverless+.png)\n\n# Serverless + JavaScript\n\n## 简介\n\n`serverlessplus` 是一个简单易用的工具，它可以帮助你将现有的 `express` / `koa` / `restify` 等框架构建的应用借助 [API 网关](https://cloud.tencent.com/product/apigateway) 迁移到 [腾讯云无服务云函数](https://cloud.tencent.com/product/scf)（Tencent Cloud Serverless Cloud Function）上。\n\n## 开始使用\n\n```shell\n$ npm install serverlessplus\n```\n\n假设有如下 `express` 应用：\n```js\n// app.js\n'use strict';\n\nconst express = require('express');\nconst app = express();\n\napp.get('/', (request, response) =\u003e {\n    response.end('hello world');\n});\n\napp.litsen(8000);\n```\n\n可以通过如下简单修改，迁移到 `serverless` 平台上：\n```js\n// app.js\n'use strict';\n\nconst express = require('express');\nconst app = express();\n\napp.get('/', (request, response) =\u003e {\n    response.end('hello world');\n});\n\n// comment out `listen`\n// exports your `app`\n\n// app.litsen(8000);\nmodule.exports = app;\n```\n\n将服务到入口文件修改为如下内容：\n```js\n// index.js\n'use strict';\n\nconst app = require('./app');\nconst serverlessplus = require('serverlessplus');\n\nconst options = {\n    binaryMIMETypes: [\n        'image/gif',\n        'image/png',\n        'image/jpeg',\n    ],\n    framework: 'express',\n};\n\nconst proxy = serverlessplus.createProxy(app, options);\n\nexports.main_handler = (event, context) =\u003e {\n    return proxy.serveRequest(event, context);\n}\n```\n\n## 示例\n\n- [express 示例](https://github.com/serverlessplus/express-example)\n- [koa 示例](https://github.com/serverlessplus/koa-example)\n- [restify 示例](https://github.com/serverlessplus/restify-example)\n\n## 支持的框架\n\n- [express](https://expressjs.com)\n- [koa](https://koajs.com)\n- [restify](http://restify.com)\n- ...\n\n## 路线图\n\n- 更多 Web 框架的支持\n- 对小程序云开发的支持\n\n`serverlessplus` 处于活跃开发中，`API` 可能在未来的版本中发生变更，我们十分欢迎来自社区的贡献，你可以通过 pull request 或者 issue 来参与。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverlessplus%2Fjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserverlessplus%2Fjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverlessplus%2Fjs/lists"}