Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 1.03 KB

README.md

File metadata and controls

31 lines (22 loc) · 1.03 KB

shower-thoughts

A simple Cloudflare Worker that returns random shower thought data from r/showerthoughts.

How it works

A fetch request is made once the API is called. The response is parsed and data is returned. The worker uses Cloudflare KV to temporally store the shower thoughts once their generated. Thoughts already stored in the KV are not generated again, and are ignored.

Usage

The API is available at https://shower-thoughts.paintbrush.workers.dev/.

curl https://shower-thoughts.paintbrush.workers.dev/
{
  "data": {
      "title": "The word \"shower\" is a verb and a noun.",
      "url": "<url>",
      "author": "<author>",
      "subreddit": "Showerthoughts"
  }
}

Caveats

  • The API may get rate limited by Reddit (unlikely, but possible).
  • The API may get congested and not return data. This is due to how we "cache" posts, as there's unfortunately not unlimited posts in the subreddit.