Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated README to include an example

  • Loading branch information...
commit e4a8b2d68bd46ee3314699170446d875c6a0b3be 1 parent ab96024
@gabrielpreston authored
Showing with 29 additions and 0 deletions.
  1. +29 −0 README
View
29 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 }
Please sign in to comment.
Something went wrong with that request. Please try again.