example-blank/handler.rb in faastruby-0.3.1 vs example-blank/handler.rb in faastruby-0.3.2
- old
+ new
@@ -1,4 +1,18 @@
def handler event
- # Do the magic here
- # Use respond_with RESPONSE, where RESPONSE is a Hash, String or Array.
+ # FUNCTION RESPONSE
+ #
+ # You can render text, json, yaml, html or js. Example:
+ # render html: '<p>Hello World!</p>'
+ # render yaml: {hello: 'world!'}
+ #
+ # Status:
+ # The default status is 200. You can set a custom status like this:
+ # render json: {error: 'Could not perform the action'}, status: 422
+ #
+ # Headers:
+ # The 'Content-Type' header is automatically set when you use 'render'.
+ # You can set custom headers using a hash with string keys. Example:
+ # render text: 'It Works!', headers: {'TransactionId' => 23928}
+
+ # Write code here
end