Coder Social home page Coder Social logo

mikros's Introduction

Mikros

A URL shortener for Nginx/OpenResty with a Redis backend.

Setup

  1. Install OpenResty & setup a Redis instance to use
  2. Adjust the nginx.conf file, particularly the four variables at the start of the server section
  3. Fire up nginx with the config file

Usage

Get a shortened URL by posting it to /, in a JSON object:

$ curl -X POST --data '{"url":"http://google.com"}' http://localhost:1234
{"originalurl":"http://google.com","shorturl":"http://my.host:1234/c7b920f57e"}
$

A json object with entries original_url and short_url is returned.

Notes

The code has no collision detection of hashes. It uses a 40bit truncated MD5 sum for a hash; if a collision occurs the key is overwritten with the new value.

License

Simplified BSD. See the LICENSE file for details.

mikros's People

Contributors

ragnar-johannsson avatar

Watchers

James Cloos 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.