Giter Club home page Giter Club logo

javiervidrua / urlshortener Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 823 KB

A simple Django API that listens on '/shortener' for GET requests with URLs to shorten, and on '/' for GET requests to return the correponding shortened URL. It was made to be hosted for free on Pythonanywhere.com, for ever.

Home Page: https://javiervidrua.pythonanywhere.com

License: MIT License

Python 5.05% CSS 43.96% JavaScript 50.98%
python django api url-shortener pythonanywhere

urlshortener's Introduction

urlshortener

A simple Django API that listens on '/shortener' for GET requests with URLs to shorten, and on '/' for GET requests to return the correponding shortened URL.

It was made to be hosted for free on Pythonanywhere.com, for ever.

The available URL of the project is: https://javiervidrua.pythonanywhere.com

To shorten a URL go to https://javiervidrua.pythonanywhere.com/shortener/?id=url-to-shorten where the id parameter holds the URL to be shortened, in this case it is 'url-to-be-shortened'.

The API is coded in such a way that it will only create one and only one shortened URL for each URL to shorten.

To get the URL of a shortened one, go to https://javiervidrua.pythonanywhere.com/?id=url-shortened where 'url-shortened' is the id that identifies the shortened URL, given to the user after shortening a URL.

Example

Let's say we want to shorten the URL https://github.com/javiervidrua/urlshortener.

What we do is go to https://javiervidrua.pythonanywhere.com/shortener/?id=https://github.com/javiervidrua/urlshortener

And we get something like: https://javiervidrua.pythonanywhere.com/?id=2d268682-51e0-4931-8114-93a059d2330d

Now if we go to https://javiervidrua.pythonanywhere.com/?id=2d268682-51e0-4931-8114-93a059d2330d, it will redirect us to https://github.com/javiervidrua/urlshortener.

Notes

  • The project was made just to get some hands-on experience with Python and Django, and even though it is entirely functional, some improvements can be done to make the URLs shorter.

  • If you want to run it in production, change DEBUG to False in 'urlshortener/settings.py'

  • Other than that, it works well and it's really fast, and I'm really happy with it.

urlshortener's People

Contributors

dependabot[bot] avatar javiervidrua avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.