Giter VIP home page Giter VIP logo

url_shorterer's Introduction

url_shorterer

Api

Returns short url for given long one

  • URL

    :9090/post

  • Method:

    POST

  • Data Params

    your_long_url: string

  • Success Response:

    • Code: 200
      Body: short_url: string
  • Error Response:

    • Code: 400 StatusBadRequest
      Possible reason: incorrect body

    OR

    • Code: 500 StatusInternalServerError
      Possible reason: server has no more short urls temporally
  • Sample Call:

    curl --location 'http://127.0.0.1:9090/post' \
    --header 'Content-Type: text/plain' \
    --data 'http://gmail.com'
    

Returns long url for given short one

  • URL

    :9091/*

  • Method:

    GET

  • Required param:

    short_url=[string]

  • Success Response:

    • Code: 301 StatusMovedPermanently
      Location: long_url: string
  • Error Response:

    • Code: 404 StatusNotFound
      Possible reason: incorrect or not found url

    OR

    • Code: 503 StatusServiceUnavailable
      Possible reason: server is too busy

    OR

    • Code: 500 StatusInternalServerError
      Possible reason: smth went wrong
  • Sample Call:

    curl --location 'http://127.0.0.1:9091/4xabacaba'
    

How to use it by yourself?

$ docker compose build ; to build images
$ docker compose -p url_shorterer up ; to run docker compose - may be slow as it use kafka
$ docker compose -p url_shorterer down ; to stop all containers

How it works?

Sequence diargams

  • Add url telegram-cloud-document-2-5469930164748045806

  • Add url inside telegram-cloud-document-2-5469930164748045740

  • Get url telegram-cloud-document-2-5469930164748045784

service diagram telegram-cloud-document-2-5469930164748045897

url_shorterer's People

Contributors

lehatrutenb 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.