如何将 postgres 与无服务器框架 node.js 集成

问题描述

我想在 node.js 中将 postgres 集成到 serverless 中。我是无服务器领域的专家。

我想知道如何实现这一点以及 serverless.yml 会是什么样子。任何演示代码/论坛/博客将不胜感激。

我的 serverless.yml 文件

service: backend
frameworkVersion: '2'

provider:
  name: aws
  runtime: nodejs12.x


functions:
  verify:
    handler: src/handler.hello
    events:
      - http:
          path: /
          method: GET
          cors: true
  auth:
    handler: src/index.handler
    events: # All events associated with this function
      - http:
          path: /auth
          method: GET
          cors: true
      - http:
          path: /auth/{any}
          method: GET
          cors: true
      - http:
          path: /api/{proxy+}
          method: GET
          cors: true
      - http:
          path: /api/{proxy+}
          method: POST
          cors: true
      - http:
          path: /api/{proxy+}
          method: PUT
          cors: true
      - http:
          path: /api/{proxy+}
          method: DELETE
          cors: true
      

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)