Sha256: 4c558b86c7c0584e9b61a262c537b62f1dae4cc91ed6c206d7ae3f35bc7ee040
Contents?: true
Size: 991 Bytes
Versions: 1
Compression:
Stored size: 991 Bytes
Contents
class DefaultApiEntry def self.call(env) status = 200 headers = { "Content-Type" => "text/html" } body = ['Hello World.'] [status, headers, body] end end module ServerlessHub module Handler ActiveSupport::Dependencies.autoload_paths += Dir[ "#{ENV["LAMBDA_TASK_ROOT"]}/app/**" ] $app ||= Rack::Builder.new do app = if defined?(ApiEntry) == 'constant' && ApiEntry.class == Class ApiEntry else Kernel.const_get(ENV.fetch('API_ENTRY_CLASS_NAME', 'DefaultApiEntry')) end run app end.to_app 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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
serverless_hub-0.1.9 | lib/serverless_hub/handler.rb |