sshort-link / client-node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node SShort Link Client

client-node

The Javascript clients for SShort Link is implemented in typescript.

Installation

$ echo '@sshort-link:registry="https://npm.pkg.github.com"' > .npmrc
$ npm install @sshort-link/client-node

Example Code

import { init, shorten } from '@sshort-link/client-node'

const accessToken = process.env['ACCESS_TOKEN'] || '';

init({ headers: { Authorization: `Bearer ${accessToken}` } });

(async () => {
  const randomShortURL = await shorten("https://example.com/long/long/long/url");
  console.log(randomShortURL)

  const defintiveShortURL = await shorten("https://example.com/long/long/long/url", {
    path: `my-custom-${Date.now()}`
  });
  console.log(defintiveShortURL)
})();

About


Languages

Language:TypeScript 97.3%Language:JavaScript 2.7%