Created
October 31, 2017 20:27
-
-
Save tanepiper/d4753e18c2293c1ec6df1b8bda7d65ab to your computer and use it in GitHub Desktop.
node-bitly examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const BitlyClient = require('bitly'); | |
| const bitly = BitleyClient('<accessToken>'); | |
| const uri = 'https://github.com/tanepiper/node-bitly'; | |
| bitly.shorten(uri).then(result => { | |
| console.log(result); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const BitlyClient = require('bitly'); | |
| const bitly = BitleyClient('<accessToken>'); | |
| const myFunc = async(uri = 'https://github.com/tanepiper/node-bitly') => { | |
| try { | |
| return await bitly.shorten(uri); | |
| } catch(e) { | |
| throw e; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment