TinyURL Ramaze Application

Posted by stoyan

Created tinyurl ramaze applicationeverything in one file – model, view, controller. Required gems: sqlite3-ruby, sequel, validatable, ramaze .Even have an API:
$ curl -O turl.rb http://zhware.net/code/ruby/ramaze/turl.rb.txt
$ ruby turl.rb
# browse http://localhost:7000/
# shorten url
$ curl http://admin:secret@localhost:7000/_api?turl=http://zhware.net/code/ruby/
# restore the original url
$ curl http://admin:secret@localhost:7000/_api?url=abc
# number of hits for given turl
$ curl http://admin:secret@localhost:7000/_api?hits=abc
Do not forget to change the BASE_URL and LOGINS values. By default the database file (sqlite3) will be created in the same directory with turl.rb . If this is not acceptable, change the DB_FILE line.

Update: created the turl project on github

Comments

Leave a response