/ComboURL

↑ ↑ ↓ ↓ ← → ← → B A Start

Primary LanguagePythonMIT LicenseMIT

ComboURL

↑ ↑ ↓ ↓ ← → ← → B A Start

ComboURL is a short exercise in writing an URL shortener. It's built on top of Flask, which is the only requirement for the project.

Currently there's no persistent storage, the in-memory database is not thread safe so take this into account when running ComboURL :).

The created URLs are of the format http://swag-host.com/up-up-down-down.

API

POST /shorten

Parameters: link should contain the link to shorten

Returns: a combo for the shortened link in text/plain format.

GET /{combo}

Returns:

  • 301 if a link matching combo is found, redirects to the link
  • 404 error if no link matches combo

Running ComboURL

Installing Flask and Gunicorn

pip install Flask
pip install gunicorn

Running the service in port 5000

cd ComboURL/
gunicorn -b 127.0.0.1:5000 main:app