Code Monkey home page Code Monkey logo

kapsule's Introduction

kapsule

kapsule
A URL shortener that collects simple user data when someone clicks a shortened link.

What does it collect ?

  • Operating system name
  • Browser name
  • Browser language
  • Country name
  • Device type (Mobile / Desktop)

How does it collect ?

All of the data is collected through HTTP headers.

  • It parses User-Agent for operating system name, browser name, device type.
  • It parses Accept-Language for browser language.
  • It uses geojs API for country name. It calls geojs with IP address it takes from X-FORWARDED-FOR header.

Apps

  • api

    It shortens URLs and return URL records to client.

    • /shorten (POST)

       {
       	"url" : "https://github.com/berabulut",
       	"options_enabled": true, // activate waiting page
       	"duration": 6, // duration of waiting page
       	"note": "Letter to a stranger." // small note to be shown in waiting page
       }
      
    • /:key (GET)

      Returns URL data. Key is unique id of shortened link. Usage:

      localhost:8080/ab123

    • /details (GET)

      Does same thing with /:key but returns multiple records (up to 3). Usage :

      localhost:8080/details?keys[0]=ab123&keys[1]=ab321&keys[2]=ab231

  • redirect

    Redirects client to target URL and collects user data.

    • /:key (GET)

      Redirects to target URL. Key is unique id of shortened link. Usage:

      localhost:8080/ab123

Build and Run

sh build.sh

Exposes api to localhost:8080 and redirect to localhost:8081.

kapsule's People

Contributors

berabulut avatar

Stargazers

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