dibrinsofor / 04266aa4e

too early to name.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

urlPlaylists

what is this?

This tool allows you to share a burst of urls as one link (bunch of supporting urls) as one link to teammates, friends, etc.

why am i making it?

I was looking for an easier way to share supporting internet resources during my events with the MLSA and the ACC and came up with this. I got to exercise some upsides of using noSQL dbs, setup an IP based rate limiting service and even introduced a faux implementation of Stripe's client level idempotency as seen here when I noticed duplicate and failed requests misbehaving. It turned into a learning opportunity.

picture of working prototype

picture of working prototype

setup

I've run out of monthly azure credits so it's down for now but if you just want to run it locally, you can:

  • setup mongodb
  • configure env vars in .env
  • build (docker build --tag urlplaylists .) and run the docker image (docker run urlplaylists)

Endpoints (API Docs)

  • Create playlists:
    sample POST request to / with Content-type:application/json. with idempotency-key as a request header for subsequent requests

    {
        "urls": ["smol.com", "uwu.com", "zyzz.com", "nattyboi.com"],
        "description": "a collection of internet slangs",
        "title": "Wannabe Zoomer"
    }

    sample response:

    {
        "message": "playlist stored succesfully",
        "rand_slug": "123jdi34"
    }
  • Get playlistss:
    make a GET request to /<rand_slug> replacing <rand_slug> with an appropriate string like "123jdi34"

    sample response:

    {
      "message": "playlist retrieved succesfully",
      "title": "Wannabe Zoomer", 
      "description": "a collection of internet slangs",
      "urls": ["smol.com", "uwu.com", "zyzz.com", "nattyboi.com"],
      ""
    }

what's coming next

I think some bits here can be reused. I plan to:

  • continue piling stuff on
  • abstract the rate-limiting and idempotency middlewares into sole repos

want to help make this better?

create an issue and we can figure something out

About

too early to name.


Languages

Language:Go 96.8%Language:Dockerfile 1.8%Language:Shell 1.4%