Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Source code for Tim's personal URL shortener, currently running at http://tiny.io
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
public
Nukefile
README
TinyIO

README

WHAT IS THIS?

This is the source for the simple tiny url service that is 
currently running at http://tiny.io.

tiny.io runs using Kurt, a simple libevent-based web
server. It can be easily scaled by deploying multiple 
Kurt-based daemons under a load-balancer such as pound
or nginx. Data is stored in MongoDB.


DEPENDENCIES

This tiny url service is built using the following components:
	Nu		The Nu scripting language
	NuMongoDB	Objective-C interface to MongoDB
	NuMarkup 	Nu operators for HTML generation	
	Kurt		A libevent-based webserver for use with Nu
	NuHTTPHelpers	HTTP helpers for use with Nu and Kurt

A MongoDB installation is also necessary.


URL CREATION

Currently tiny urls are created with a post to root of the tiny.io API.

Examples:

1. curl http://tiny.io/ -d url=http://www.neontology.com -d key=TINY_KEY

   This generates a random string to use as the tiny url.

2. curl http://tiny.io/ -d url=http://programming.nu -d tiny=nu -d key=TINY_KEY

   This attempts to use the specified string as the tiny url.

Tiny url creation will fail if a specified "tiny" value is in use, 
and if a url already has been mapped to a tiny value, that value will
be used instead of any specified or newly-generated value.


AUTHENTICATION

Currently the tiny server uses a trivial method of authentication. URL 
shortening requests must include a user key that is read from the 
TINY_KEY environment variable. Optionally, one ore more user keys
may be stored in the "secrets" collection in objects with the a
key named "key". To set this from the MongoDB shell, use the following:

> db.secrets.insert({key:"my-secret"})


MORE HELPFUL MongoDB COMMANDS

# select the tinyio database
> use tinyio

# remove hits added by benchmarking
> db.hits.find({user_agent:"ApacheBench/2.3"})


COMMAND LINE TOOLS

# to backup a collection
% mongoexport -d tinyio -c tinyurls > tinyio-tinyurls.json

# to restore a collection
% mongoimport -drop  -c tinyurls -d tinyio < tinyio-tinyurls.json


COPYRIGHT

Copyright 2010, Neon Design Technology, Inc.


LICENSE

Apache License, v2.0.

Something went wrong with that request. Please try again.