Hacker News new | ask | show | jobs
by k__ 2478 days ago
I found it a bit strange that they sold Lambda as THE new way to do API development.

You can connect API-Gateway with other services via Velocity templates, which don't have cold starts.

AppSync also doesn't suffer from cold starts.

Both are also serverless services.

Lambda is good if the other solutions are missing something, so you can drop it in quickly, but I wouldn't use it as the go to services for that...

1 comments

API-Gateway can return HTML?
Sure.

You can write Velocity templates for integration responses.

Normally they are JSON because that's what all the AWS services return and API-Gateway just passes them along.

But you could write something like this:

    #set($pets = $input.path('$'))
    <html lang="en">
      <head>
        <meta charset="utf-8">
        <title>Pets</title>
      </head>
      <body>
        <table>
        <th>ID</th>
        <th>Type</th>
        <th>Price</th>
            #foreach($pet in $pets)
                <tr>
                    <td>$pet.id</td>
                    <td>$pet.type</td>
                    <td>$pet.price</td>
                </tr>
            #end
        </table>
      </body>
    </html>