The Javascript clients for SShort Link is implemented in typescript.
$ echo '@sshort-link:registry="https://npm.pkg.github.com"' > .npmrc
$ npm install @sshort-link/client-node
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)
})();