Giter Club home page Giter Club logo

shorti's Introduction

SHORTI

Shorti is an API first (and only) URL shortener and click counter.

Deploy

It is comprised of three end points.

HTTP Method End Point Function
POST / Create a new shortened URL
GET /:id Redirect to full URL and track the click
GET /info/:id What URL is shortend and the number of clicks

The create end point will always require an API_KEY. The info end point can optionally require the API_KEY.

Installation

  1. Grab the source
  2. bundle install
  3. bundle exec rails db:setup
  4. bundle exec rails db:migrate
  5. bundle exec rails server

Specs

bundle exec rails spec should do the trick.

Configuration

KEY Description
SHORTI_API_KEY Controls access to create a new link. Optionally controls access to info
SHORTI_BASE_URL By default, Shorti will use the current request url, but you can optionally override it.
SHORTI_INFO_API_KEY If this key exists, Shorti will require an API Key for the info end point

Try It Now

I have a version up on Heroku you can try (URL won't be that short).

  curl -d "url=https://scottw.com&api_key=HOAGIES" https://shortilinks.herokuapp.com

Please note, this data will likely be cleared out every once in a while.

Todo

One outstanding item would be to track unique clicks (likely via IP Address). Not 100% yet if this will be added.

Change Log

  1. If HTTP_ACCEPT = 'application/json' json data will be returned. Otherwise, responses will be return as plain text.

shorti's People

Contributors

scottwater avatar

Watchers

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