-
-
Save juliachn/17f0d4eee6cfda19b3817942fd9bb379 to your computer and use it in GitHub Desktop.
A friendly api endpoint that says something nice to me.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
def lambda_handler(event:, context:) | |
name = event["first_name"] | |
encouragements = ["<array of sentences>"] | |
random_number = rand(encouragements.size) - 1 | |
{ statusCode: 200, | |
body: JSON.generate( "hey #{name}, #{encouragements[random_number]}") } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment