Posting memes until I get my master's degree day 303 meme 505

Submitted to r/wholesomememes by AskTrashMeme

This example shows a one-line fetch call to an API which destructures out some specific data object properties for use in the HTML rendering below.

The Code:

import BaseLayout from '../../layouts/BaseLayout.astro';
const { title, url, preview, subreddit, author } = await fetch(``)
  .then(response => response.json())
<BaseLayout title="Meme Fetching">
    <p style="font-size: 0.8rem">Submitted to r/{subreddit} by {author}</p>
    <img src="{preview[1]}">

Note that the response object of the API call is of the form:

  "postLink": "",
  "subreddit": "wholesomememes",
  "title": "Thank you dad",
  "url": "",
  "nsfw": false,
  "spoiler": false,
  "author": "CaptinDerpII",
  "ups": 497,
  "preview": [