-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated README to include an example
- Loading branch information
1 parent
ab96024
commit e4a8b2d
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 } |