A simple Node.js Web API I created for fetching memes off Reddit. Each GET request to my API returns a new random meme in JSON format.
-
My API uses the GOT HTTP request library to parse the following URL: https://www.reddit.com/r/{insert_a_subreddit_name_here}/random.json
-
Relevant information is retrieved from the URL such as the meme's title, image URL, upvotes, downvotes, and comments.
-
My API then takes that information to construct a JSON object that gets returned to the user.
Note: My API will work for most subreddits. Obviously it will return an error if you try to access a subreddit that doesn't exist. Most banned and NSFW subreddits will not work either since Reddit returns an error code if you try to access them.