Adonis Bitly
This package is an shorten url built on top of node-bitly.
Getting Started
Install the package using the adonis
CLI.
> adonis install adonis-bitly
Instruction: (Click Here).
Configure
Configure token inside the config/bitly.js
const Env = moduleexports = // set in here accessToken: Env
or inside the .env
BITLY_TOKEN=7ab070f4e5xxxx0bac67xxxx24249b3b0606xxxx
Usage
Just make long become short:
// Controllerconst Bitly = async { // get short url const result = await Bitly // example: http://bit.ly/2uWbQfS return result}
If You need more detail:
// Controllerconst Bitly = async { // get detail url (set true) const result = await Bitly /** * example: { "url": "http://bit.ly/2UbtGSS", "hash": "2UbtGSS", "global_hash": "2UeD4xW", "long_url": "https://github.com/agung96tm/adonis-bitly/", "new_hash": 0 } */ return result}
How Can I Get Token
- Login to https://bitly.com/
- Open Your 'Edit Profile'
- Click 'Generic Access Token'
- Insert Your Password Bitly Password (if you login with google / facebook, try to reset password)
- You will get that token