Skip to content

Latest commit

 

History

History
37 lines (29 loc) · 1.13 KB

README.md

File metadata and controls

37 lines (29 loc) · 1.13 KB

NPM

TinyURL Build Status

http://TinyURL.com URL Shortener Node.js Module

Example Shorten:

First run npm install TinyURL to install the TinyURL package to your system.

var TinyURL = require('tinyurl');

TinyURL.shorten('http://google.com', function(res, err) {
    if (err)
        console.log(err)
	console.log(res); //Returns a shorter version of http://google.com - http://tinyurl.com/2tx
});

//Promise Example
TinyURL.shorten('http://google.com').then(function(res) {
    console.log(res)
}, function(err) {
    console.log(err)
})

// Resolve Example
TinyURL.resolve("http://tinyurl.com/2tx").then(
  function(res) {
    console.log(res); //Returns http://google.com, the full URL located at http://tinyurl.com/2tx
  },
  function(err) {
    console.log(err);
  }
);

This Package Is Under The MIT License