This is a JavaScript and TypeScript wrapper for the Apna.Link URL shortening API.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Node.js and npm installed on your local development machine.
To install the package, run:
npm install apna-link-js
First, import the package:
const ApnaLinkAPI = require('apna-link-js').default;
Then, create an instance of the ApnaLinkAPI
class:
const api = new ApnaLinkAPI('your-api-key'); // Get it from https://apna.link/account
You can now use the api
instance to interact with the Apna.Link API:
api.shorten('https://example.com')
.then(shortUrl => console.log(`Short URL: ${shortUrl}`))
.catch(error => console.error(`Error: ${error}`));
To run the tests, use the following command:
npm test
This library is based on the Apna.link API Docs.
Please read CONTRIBUTING for details on our code of conduct, and the process for submitting pull requests to us.
This project is licensed under the MIT License - see the LICENSE file for details