Sha256: c1dfda1a4acd943d0443d98023e4c592fea91d7bfb7e7c1ae4c45c89b6a33bb1

Contents?: true

Size: 547 Bytes

Versions: 7

Compression:

Stored size: 547 Bytes

Contents

# require 'cool-gem'
require 'json'

# 1) If you don't have a workspace, create one by running:
# faastruby create-workspace WORKSPACE_NAME
# 2) To deploy this function, cd into its folder and run:
# faastruby deploy WORKSPACE_NAME
def handler event
  headers = {
    'Content-Type' => 'text/plain',
    'My-Custom-Header' => 'Value'
  }
  data = event.body ? JSON.parse(event.body) : {}
  # The response must be a Hash, Array or String.
  response = "Hello, #{data['name'] || 'World'}!"
  respond_with response, status: 200, headers: headers
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
faastruby-0.3.1 example/handler.rb
faastruby-0.2.6 example/handler.rb
faastruby-0.2.5 example/handler.rb
faastruby-0.2.3 example/handler.rb
faastruby-0.2.2 example/handler.rb
faastruby-0.2.1 example/handler.rb
faastruby-0.2.0 example/handler.rb