goorl
v3.0.1
Published
Shorten urls with goo.gl
Downloads
36
Readme
goorl
Shortens url with goo.gl
Installation
From npm
$ npm i goorl
Usage
Required inputs
key Your google API key
url The URL you want to shorten
Promises
const goorl = require('goorl')
const options = {
key: 'your-google-api-key',
url: 'http://www.telemark.no/Planer/Regional-planstrategi/Offentlig-ettersyn-ny-regional-planstrategi'
}
goorl(options)
.then(url => console.log(url))
.catch(error => console.error(error))
Callbacks
const goorl = require('goorl')
const options = {
key: 'your-google-api-key',
url: 'http://www.telemark.no/Planer/Regional-planstrategi/Offentlig-ettersyn-ny-regional-planstrategi'
}
goorl(options, (error, url) => {
if (error) {
console.error(error)
} else {
console.log(url)
}
})