Skip to content

Commit

Permalink
Updated README to include an example
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielpreston committed Apr 19, 2012
1 parent ab96024 commit e4a8b2d
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README
@@ -0,0 +1,29 @@
Example script:
var Yourls = require('./node-yourls/yourls');

var yourls_url = 'ph.ly';
var yourls_api = '1a40d1e654';

var yourls = new Yourls(yourls_url, yourls_api);

yourls.shorten('https://github.com/gabrielpreston/node-yourls', function(error, result) {
if (error) {
throw error;
}
console.log(result);
});

Output:
{ status: 'fail',
code: 'error:url',
url:
{ keyword: '',
url: 'https://github.com/gabrielpreston/node-yourls',
title: 'gabrielpreston/node-yourls · GitHub',
date: '2012-04-18 15:00:56',
ip: '204.236.242.146',
clicks: '0' },
message: 'https://github.com/gabrielpreston/node-yourls already exists in database',
title: 'gabrielpreston/node-yourls · GitHub',
shorturl: 'http://ph.ly/dzg-v',
statusCode: 200 }

0 comments on commit e4a8b2d

Please sign in to comment.