service: public-slack-api

plugins:
  - serverless-plugin-typescript
  # - serverless-api-gateway-throttling
  - serverless-offline

provider:
  name: aws
  runtime: nodejs20.x
  region: us-east-1
  stage: ${opt:stage, env:ENVIRONMENT, 'dev'}
  environment: ${file(env.json)}

# Configuration
custom:
  # Get environment from env or default to dev
  stage: ${opt:stage, env:ENVIRONMENT, 'dev'}
  serverless-offline:
    printOutput: true
    httpPort: 4000
    lambdaPort: 4002
    environment: ${file(env.json)}

functions:
  unifiedHandler:
    handler: dist/index.handler
    events:
      - http:
          path: /{proxy+}
          method: any
          cors: true

resources:
  Outputs:
    ApiEndpoints:
      Description: 'API Endpoints'
      Value:
        Fn::Join:
          - ''
          - - 'API: https://'
            - Ref: 'ApiGatewayRestApi'
            - '.execute-api.'
            - Ref: 'AWS::Region'
            - "/${env:ENVIRONMENT, 'dev'}"
