Skip to content

annbgn/url_shortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

url shortener

installation

  • clone this repo
  • create virtual env
  • install requirements:
pip3 install -r url_shortener/requirements.txt

usage

  • run locally (if no redis_url is specified, fall back to default local redis url):
RESIS_URL=some_value python url_shortener/app/app/manage.py runserver
  • send a request with a url to shorten, get short url in response
curl -X POST "localhost:8000/get_short" -d '{"url":"http://google.com/"}' -H 'Content-Type: application/json'
{"short_url": "localhost:8000/redirect/75634539-4342-4021-b58d-65dfdced2827"}
  • you can be redirected to original long url by requesting the short url from response above. note that cache stores key-value pair for 1h and if it's expired, you'll get 410 status code
curl -X GET "localhost:8000/redirect/75634539-4342-4021-b58d-65dfdced2827" -vvv --location

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages