Module: ServerlessHub::Handler

Defined in:
lib/serverless_hub/handler.rb

Class Method Summary collapse

Class Method Details

.call(event: {}, context: {}) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/serverless_hub/handler.rb', line 49

def self.call(event: {}, context: {})
  return "Warm Up" if event["source"] == "serverless-plugin-warmup"
  
  Lamby.handler $app, event, context, rack: :api
rescue Exception => msg
  p "errors: #{msg}"
  response = {
    "statusCode" => 500,
    "body" => ENV["RAILS_ENV"] == "production" ? "Something wrong happened" : msg,
  }
end