1.0.1 • Published 4 years ago
@short-url/shorturl v1.0.1
ShortURL – A free URL Shortener for Node JS
Install
npm install @short-url/shorturlUsage
See examples folder for a complete example
Make a short URL
shortURL.makeShortUrl(url, options, callback)
Where
- url is the url to make
- options is an options object
- callback is the callback to run - callback(error, body)
Example
var makeShortUrl = require("@short-url/shorturl").makeShortUrl;
makeShortUrl("https://www.google.com/", {}, function (error, data) {
    if (error) {
        return console.log('ERROR', error);
    }
    console.log('URL', url);
});
// With async function
makeShortUrl("https://www.google.com/")
    .then((url) => {
        console.log('URL', url);
    })
    .catch((err) => {
        console.log('ERROR', error);
    });