Hello, World!
The inevitable Hello World example.
Hi there! This is a playground to test out Netlify’s Lambda Functions.
You can browse the code for this site on GitHub, or play around with the code yourself deploying a copy to Netlify.
The inevitable Hello World example.
The Hello World example can get sweeter with some async syntactic sugar. With async, we can return the response instead of dealing with callbacks.
Customize the greeting calling the Lambda endpoint with an optional
name
parameter.
Let’s make sure we only process POST requests for our customized greeting.
Storing secrets like API tokens can be tricky in web apps. Lambdas and environment variables to the rescue!
For this example, I’m defining environment variable "GREETING" in the Netlify site dashboard under Settings > Build & deploy > Build environment variables.
Note: environment variables get baked into your function at deploy time, so you need to trigger a new deploy after you change them.