XYOracleNetwork/api-xyo-nodejs

View on GitHub
serverless.yml

Summary

Maintainability
Test Coverage
service: ${env:SERVICE_NAME}

frameworkVersion: "^2.1.0"
useDotenv: true

plugins:
  - serverless-domain-manager
  - serverless-offline
  - serverless-api-gateway-caching
  - serverless-bundle

provider:
  name: aws
  apiGateway:
    minimumCompressionSize: 1024
    shouldStartNameWithService: true
  runtime: nodejs14.x
  versionFunctions: false
  environment:
    ARCHIVIST_MONGO_USERNAME: ${env:ARCHIVIST_MONGO_USERNAME}
    ARCHIVIST_MONGO_PASSWORD: ${env:ARCHIVIST_MONGO_PASSWORD}
    ARCHIVIST_MONGO_DOMAIN: ${env:ARCHIVIST_MONGO_DOMAIN}
    ARCHIVIST_MONGO_DATABASE: ${env:ARCHIVIST_MONGO_DATABASE}

  timeout: 29

custom:
  apiGatewayCaching:
    enabled: true
    ttlInSeconds: 3600
    perKeyInvalidation:
      requireAuthorization: false
  bundle:
    sourceMaps: true
    caching: true
    stats: true
    linting: true
    tsconfig: "tsconfig.json"
    externals:
      - firebase-admin
      - aws-lambda
      - mongodb
      - lodash
  domain:
    dev: localhost
    beta: beta.${env:DOMAIN}
    prod: ${env:DOMAIN}
  customDomains:
    - rest:
        certificateName: ${env:CERTIFICATE_NAME}
        domainName: ${self:custom.domain.${opt:stage, 'dev'}}
        stage: ${opt:stage, 'dev'}

functions:
  block-sample:
    handler: src/archive/block/sample/get.entryPoint
    events:
      - http:
          path: /archive/{archive}/block/sample/{size}
          method: GET
          cors: true
  block-get-hash:
    handler: src/archive/block/hash/get.entryPoint
    events:
      - http:
          path: /archive/{archive}/block/hash/{hash}
          method: GET
          cors: true
  block-get-recent:
    handler: src/archive/block/recent/get.entryPoint
    events:
      - http:
          path: /archive/{archive}/block/recent/{limit}
          method: GET
          cors: true
  reflect-get:
    handler: src/reflect/get.entryPoint
    events:
      - http:
          path: /reflect
          method: GET
          cors: true