Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Simple URL shortener using Xitrum and MongoDB

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 config
Octocat-spinner-32 lib
Octocat-spinner-32 project
Octocat-spinner-32 public No need for /public URL prefix now October 12, 2011
Octocat-spinner-32 sbt
Octocat-spinner-32 script
Octocat-spinner-32 src
Octocat-spinner-32 .gitignore
Octocat-spinner-32 DEVELOPMENT
Octocat-spinner-32 INSTALL
Octocat-spinner-32 README
Octocat-spinner-32 build.sbt
README
Simple URL Shortener using Xitrum (https://github.com/ngocdaothanh/xitrum) and MongoDB.

URLs will be shorten to a 7-character string using base 62. In theory, it can
support up to 62^7 unique URLs (more than 3 trillions).

== POST

To shorten a URL, send a POST request to:
http://SERVER/api/shorten?url=ESCAPED_URL

Response:
* 200: the body is a random key to lookup the original URL later
* 500: server error, for example the DB may be down

If you do not like the key to be random, send a POST request to:
http://SERVER/api/shorten?url=ESCAPED_URL&key=KEY

Characters in KEY must be a-z, A-Z, _, or -

Response:
* 200 or 500: same as above
* 400: the key contains invalid charater(s)
* 409: the key has been chosen

== GET

To be redirected to the original (non-escaped) URL, send a GET request to:
http://SERVER/KEY

Response:
* 302: the client will be redirected to the original URL
* 404: invalid key or the key has been expired
* 500: server error, for example the DB may be down
Something went wrong with that request. Please try again.