service: ${self:custom.app}

plugins:
  - serverless-webpack
  - serverless-dynamodb-local
  - serverless-offline

custom: ${file(./serverless.${opt:stage,"local"}.json)}

provider:
  stage: ${opt:stage,"local"}
  deploymentBucket:
     name: ${env:bucket,self:custom.bucket,""}
  timeout: ${self:custom.timeout}
  RestapiId:
    Fn::GetAtt:
      - ApiGatewayRestApi
      - RootResourceId
  apiGateway:
    restApiId: ${env:restApiId,self:custom.restApiId,""} 
    restApiRootResourceId: ${env:restApiRootResourceId,self:custom.restApiRootResourceId,""}
  #   escription: bot apigateway
  name: aws
  region: ${env:region,self:custom.region,"us-east-1"}
  runtime: nodejs8.10
  role: ${env:role,self:custom.role}




package:
  exclude: ${self:custom.exclude}

functions:
  app:
    environment: ${self:custom.environment}
    handler: ${self:custom.handler,"app/index.handler"}
    name: ${opt:stage,"local"}-nodebots-${self:custom.app}
    events:
      - http:
         method: ANY
         path: /${self:custom.app}
        #  cors: ${self:custom.cors,false}
      - http:
         method: ANY
        #  cors: ${self:custom.cors,false}
         path: /${self:custom.app}/{proxy+}


