tiny-url-generator
v1.0.1
Published
A simple tiny url generator
Downloads
33
Maintainers
Readme
tiny-url-generator
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.