Skip to content

This is a Django Rest Framework API that can create short URLs and retreive original URLs from the short ones. Created for education, not meant for real world use.

Notifications You must be signed in to change notification settings

bzhr/simple_url_shortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple URL Shortener API with Django and Django Rest Framework

Set Up

To create a virtual env and install dependencies run:

pipenv shell

pipenv install

To run the server:

./manage.py runserver

API Endpoints

There are two endpoints, one to create a short URL and another to retreive the original link from a short URL.

Create short URL

  • Make a POST request to /shorten-url
  • POST data format: {"url": "https://www.django-rest-framework.org/tutorial/quickstart/"}
  • Example response:
{
    "url": "https://www.django-rest-framework.org/tutorial/quickstart/",
    "short_code": "MjY="
}

Retreive the original URL

  • Make a POST request to /retreive-original-url
  • POST data format: {"short_code": "MjM="}
  • Example response:
{
    "url": "https://www.django-rest-framework.org/tutorial/quickstart/"
}

Testing

To run tests:

./manage.py test

About

This is a Django Rest Framework API that can create short URLs and retreive original URLs from the short ones. Created for education, not meant for real world use.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages