Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持serverless #217

Closed
daqi opened this issue Feb 27, 2020 · 4 comments
Closed

支持serverless #217

daqi opened this issue Feb 27, 2020 · 4 comments

Comments

@daqi
Copy link

daqi commented Feb 27, 2020

目标:
实现ssr项目支持serverless部署

需求:

  • koa实例化从异步方式改成同步方式
  • 导出koa实例,不需要监听(listen)端口
  • 精简依赖,只保留运行所需依赖
Diablohu added a commit that referenced this issue Feb 27, 2020
@Diablohu
Copy link
Member

serverless 脚本比 Web 服务器的区别

  • 不会自动检查端口是否被占用
  • 不会自动侦听端口
  • 默认输出 koa app 实例
  • serverBeforeserverAfter 生命周期方法必须为同步函数

Diablohu added a commit that referenced this issue Feb 27, 2020
Diablohu added a commit that referenced this issue Feb 27, 2020
@Diablohu
Copy link
Member

目前已可用

demo: http://service-kunit5z5-1252144562.bj.apigw.tencentcs.com/

其他问题有待进一步观察

@daqi
Copy link
Author

daqi commented Mar 11, 2020

服务端打包不会编译依赖进去,导致node_module体积过大,无法发布

@Diablohu
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants