dwyl / learn-aws-lambda

✨ Learn how to use AWS Lambda to easily create infinitely scalable web services
1.05k stars 202 forks source link

Render HTML in Lambda Response? #27

Open nelsonic opened 8 years ago

nelsonic commented 8 years ago

How do we return html as the response of a Lambda Function?

aaronshaf commented 8 years ago

See: https://medium.com/@devknoll/rendering-react-with-amazon-lambda-e4e85a788257

Key part:

And change the Response Model for 200 to text/html. Now go back and edit the Integration Response. Edit the application/json mapping template to text/html, and change Output Passthrough to Mapping Template. Finally, enter: $input.path('$') This is just telling Amazon to take the output from our function (a JSON string) and write it out directly, instead of as JSON.

nelsonic commented 8 years ago

Thanks @aaronshaf :+1: Reading it now. :mag: