tiny-url-generator

1.0.1 • Public • Published

tiny-url-generator npm package

A simple URL shortener written in node.js using tiny.piedevelopers.com as the API.

Installation

npm install tiny-url-generator

Usage

const ls = require('tiny-url-generator');

ls.generate({
  url: "https://piedevelopers.com",
  title: "PieDeveloper"
})
  .then((res) => {
    console.log("Response: ", res);
  })
  .catch((err) => {
    console.log("Error: ", err);
  });

sample output

{
  "message": "OK",
  "status": true,
  "data": {
    "link": "https://tiny.piedevelopers.com/go/YnLg9Q",
    "title": "PieDeveloper",
    "timestamp": 1690042585,
    "expiry": 0,
    "isAnalyticsEnabled": 0
  }
}

API Reference

generate()

Generates a short URL 

Parameters

  • title
    The title of the URL.
  • url
    The URL to shorten.
  • expiry (optional)
    The expiry time of the URL. (0 = never)
  • analytics_password (Optional)
    The password for the analytics page (optional). if not provided, analytics will be disabled.

Response

The response is a JSON object with the following properties:

  • link
    The shortened URL.
  • title
    The title of the URL.
  • expiry
    The expiry time of the URL.
  • analytics_link
    The URL to the analytics page (optional)

Rate Limiting

The API has a rate limit of 40 requests per minute. If you exceed this limit, you will receive a 429 Too Many Requests response.

Contributing

Pull requests are welcome. For major changes, please open an issue.

License

MIT

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i tiny-url-generator

      Weekly Downloads

      38

      Version

      1.0.1

      License

      ISC

      Unpacked Size

      4.04 kB

      Total Files

      4

      Last publish

      Collaborators

      • abhishekjnvk