npm.io
1.0.2 • Published 1 year ago

react-urlshortner

Licence
ISC
Version
1.0.2
Deps
1
Size
55 kB
Vulns
0
Weekly
0

URL Shortener Library

A lightweight and customizable URL shortener library for Node.js and browser applications. Shorten URLs effortlessly using your API endpoint with built-in validation and error handling.


Features

  • Validates URLs before sending requests.
  • Secure and reliable with axios for API communication.
  • Works seamlessly in Node.js, Reactjs, Nextjs and browser environments.

Installation

Install the package using npm & yarn:

npm install react-urlshortner

Example

import { URLShortener } from "react-urlshortner";

const shortener = new URLShortener();

shortener.shorten("https://longurl.com/some/path")
    .then(shortUrl => console.log("Shortened URL:", shortUrl))
    .catch(error => console.error("Failed to shorten URL:", error));

Support Us

Maintaining and improving this project incurs server costs. If you find this library helpful, consider supporting us!

Donate for Server Cost and Support


Note:

When donating, please mention whether your contribution is intended for server costs or to support the developer. This helps us allocate resources effectively and prioritize improvements!