Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zh/turl
TinyURL service in Ramaze
https://github.com/zh/turl
Last synced: 10 days ago
JSON representation
TinyURL service in Ramaze
- Host: GitHub
- URL: https://github.com/zh/turl
- Owner: zh
- Created: 2008-05-28T15:16:50.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2009-07-16T01:18:42.000Z (over 15 years ago)
- Last Synced: 2023-04-10T23:24:10.315Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 87.9 KB
- Stars: 8
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
TinyURL Ramaze Application
===========================Required gems
--------------sqlite3-ruby, sequel, validatable, ramaze, thin
Features
---------- everything in one file - model, view, controller
- auto create the database if missing
- unique urls in the database
- url hits counting
- API for command-line access - can shorten urls and restore the original urlsUsage
------$ curl -O turl.rb "http://github.com/zh/turl/tree/master%2Fturl.rb?raw=true"
$ ruby turl.rb
# browse http://localhost:7000/
# shorten url (turl)
$ curl http://admin:secret@localhost:7000/_api?turl=http://github.com/zh/turl/
# restore the original url
$ curl http://admin:secret@localhost:7000/_api?url=abc
# number of hints for given turl
$ curl http://admin:secret@localhost:7000/_api?hits=abcDo 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.