Hacker News new | ask | show | jobs
by Scarbutt 2477 days ago
API-Gateway can return HTML?
1 comments

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>