Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2 from d10/master
Browse files Browse the repository at this point in the history
Improve `README.md`
  • Loading branch information
tanepiper committed Apr 25, 2014
2 parents 91c8719 + 2af46eb commit b99e78b
Showing 1 changed file with 39 additions and 17 deletions.
56 changes: 39 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,44 @@
Nodejs git.io module
====================
# `gitio`

A simple module to call the [git.io url shortner service](https://github.com/blog/985-git-io-github-url-shortener) with
nodejs, the module returns a simple object with the status code and URL if created.
A Node.js module to call GitHub's [git.io url shortener service](https://github.com/blog/985-git-io-github-url-shortener).

Usage
-----
## Usage

var gitio = require('gitio');
```js
var gitio = require('gitio');

// Pass a direct URL and get back a random URL
gitio('https://github.com/tanepiper/node-gitio', function(err, result) {
if (err) throw err;
console.log(result);
});
// Pass a direct URL and get back a random URL
gitio('https://github.com/tanepiper/node-gitio', function(err, result) {
if (err) throw err;
console.log(result);
});

// Pass an optional key to get the URL of your request
gitio('https://github.com/joyent/node', 'nodejs', function(err, result) {
if (err) throw err;
console.log(result);
});
// Pass an optional key to get the URL of your request
gitio('https://github.com/joyent/node', 'nodejs', function(err, result) {
if (err) throw err;
console.log(result);
});
```

## API

### gitio(url, [code], cb)

#### url

Type: `string`

The `github.com` URL to shorten.

#### code

Type: `string`

The shortened URL path.

#### callback(err, url)

Type: `function`

A callback invoked with two arguments; an error object if an error occurred,
and the shortened URL.

0 comments on commit b99e78b

Please sign in to comment.