微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决如何将 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 举报,一经查实,本站将立刻删除。