Skip to content

Instantly share code, notes, and snippets.

@juliachn
Created March 3, 2024 12:27
Show Gist options
  • Save juliachn/17f0d4eee6cfda19b3817942fd9bb379 to your computer and use it in GitHub Desktop.
Save juliachn/17f0d4eee6cfda19b3817942fd9bb379 to your computer and use it in GitHub Desktop.
A friendly api endpoint that says something nice to me.
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