Skip to content

Aszanat/Short-URL-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Short-URL-API

Recruitment task - backend developer

Create a project "API in DRF for shortening urls" - something like URL Shortener, Branded Short Links & Analytics | TinyURL, but just the API.

The project should allow you to:

👉 create a shortened urls, that is, for example, you put http://example.com/very-very/long/url/even-longer and in return you get a short url generated by the API, such as http://localhost:8000/shrt/%5C%60

👉 expansion of the shortened url to the original one, which is the inverse of the previous operation.

How to use this?

Below I describe Linux workflow for running this project, any search engine should be able to find you a Windows or Mac equivalents. Feeling incapable? Try Chat GPT!

Wake me up:

python -m venv env

source env/bin/activate

Before you go-go:

pip install -r requirements.txt

cd url_api

python manage.py runserver

This is when you can use API at (given by django app itself) address, most likely: http://127.0.0.1:8000/

"Wait, it's not working, what have I doneee!?"

It's ok, it's ok. Path "/" is not available because this is just an API, not a full page, so you probably actually want: http://127.0.0.1:8000/api/

For creating a new short url (POST requests only): http://127.0.0.1:8000/api/create

This API method requires a string (aka, text in "quotes") in it's application/json body

For retrieving a long url from previously created short url (GET requests only): http://127.0.0.1:8000/api/find

This API method requires a query string (NOT in "quotes" this time): shrt=your_short_url, so you should call for example http://127.0.0.1:8000/api/find/?shrt=http://127.0.0.1:8000/shrt/12345678

Don't leave me hanging on like a yo-yo:

Ctrl + C

deactivate

About

Recruitment task - backend developer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages