server side implementation (design doc / couchapp) of a url shortening service driven by a CouchDB
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
_docs
updates
vendor
.couchappignore
.ericaignore
.gitignore
LICENSE
README.md
_id
couchapp.json
language
rewrites.json
validate_doc_update.js

README.md

CouchDB url shortener

This couchapp (CouchDB design doc) is an API for url shortening.

The couchapp provides mainly two services on the API endpoint /url

  1. create a short URL (~20 characters) that points to the longer URL
  2. redirect/forward every request of the short URL to the longer URL

You may want to read the full story. Finally you can read the commit/tag history to review the implementation details.

installation

You will need a CouchDB installed/hosted and one of the upload tools couchapp or erica

Clone the repo and enter the directory.

$ couchapp push http://admin:password@couchdbdomain:port/databasename

Upload the couchapp. Alternatively upload targets can be defined in the .couchapprc file.

The repo contains a test shorturl doc which will uploaded automatically with the couchapp. To test the installation request http://couchdbdomain:port/databasename/_design/urlshortener/_rewrite/url/test-url - it should forward you to the blog post.

Because thats a huuuge URI you may also want to enable a vhost in the local.ini.

//subdomain without endpoint path
[vhosts]
sub.domain.tld=databasename/_design/urlshortener/_rewrite/url

//subdomain with endpoint path
[vhosts]
sub.domain.tld=databasename/_design/urlshortener/_rewrite

Also, you can change the API endpoint paths in the rewrites.json

get in touch

Feel free to open issues, comment code lines ... it's a maintained thing I am llabball in twitter.