Skip to content

telemark-arkiv/goorl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status js-standard-style

Deprecated

Google discontinued the goo.gl service in March 2019.

See this blog post for alternatives

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)
  }
})

License

MIT