/url_shortener

A Url shortener implemented in Django and Graphene-Python(GraphQL)

Primary LanguagePython

URL SHORTENER

This is a simple URL Shortener implementated in django and graphene(GraphQL for Python).

Installation

  1. Clone the Repo:-

git clone https://github.com/ashish493/url_shortener

  1. Install the dependencies:-

pip install -r requirements.txt

  1. Run the flask server in the app directory:-

python manage.py runserver

  1. Open http://localhost:8000/graphql in your web browser.

Once the server is running our API, we can send the queries through the graphql API in the form as shown.

mutation {
  createUrl(fullUrl:"https://summerofcode.withgoogle.com/archive/2020/projects/5699259774533632/") {
    url {
      id
      fullUrl
      urlHash
      clicks
      createdAt
    }
  }
}

The API is designed to take the input url along with some other parameters. It will then convert the url into hashes using MD5 Hash and then store the links in the database.

However, MD5 Hash is not recommend for use in the production servers because of the MD5 Collision Vulnerability.

Since, it is a fully backend oriented project, I haven't created any specific frontend client for this project. However, we would be using the GraphiQL UI from the GraphiQL interface.

Acknowledgement

I have used some of code snippets from the official docs of graphene-python