函数计算中,请问有没有HttpRequest,HttpResponse,Context的ts类型库?

函数计算中,Node.js 创建的Http Handler,请问有没有HttpRequest,HttpResponse,Context的ts类型库?
https://help.aliyun.com/zh/fc/http-handler
例如:
exports.handler = (req: HttpRequest, resp HttpResponse, context Context) => {
...
}

展开
收起
多麻辣哦 2024-01-17 14:07:50 40 分享 版权
1 条回答
写回答
取消 提交回答
  • 面对过去,不要迷离;面对未来,不必彷徨;活在今天,你只要把自己完全展示给别人看。

    在函数计算中,可以使用@alicloud/fc-core库来获取HttpRequest、HttpResponse和Context的类型。首先需要安装这个库:

    npm install @alicloud/fc-core
    

    然后在代码中使用这些类型:

    import { HttpRequest, HttpResponse, Context } from '@alicloud/fc-core';
    
    exports.handler = (req: HttpRequest, resp: HttpResponse, context: Context) => {
      // ...
    }
    
    2024-01-17 15:08:13
    赞同 展开评论

快速交付实现商业价值。

还有其他疑问?
咨询AI助理