Skip to content

EhtashamAli/TinyURL

Repository files navigation

Node.js Module for tinyUrl

Coverage Status

Build Status

Getting Started

Built over TINYURL API

This module provides two functions: Shorten and Convert

Alnog with two Utill functions: extractHostname and extractRootDomain

Installation

NPM

Using npm:

npm i @ehtashamali/tinyurl

Example

let {
  shorten,
  convert,
  extractHostname,
  extractRootDomain
} = require("tiny-url");
//Without Alias
shorten("https://stackoverflow.com")
  .then(link => {
    //returns shorten url ex: tinyurl.com/adwa222
    console.log("Short Url:", link);
  })
  .catch(error => console.log(error.message));

//With Alias
shorten("https://stackoverflow.com", "MyTestAlias")
  .then(link => {
    //returns shorten url ex: tinyurl.com/MyTestAlias
    console.log("Short Url:", link);
  })
  .catch(error => console.log(error.message));

convert(link)
  .then(result => {
    //returns target url
    console.log("Converted: ", result);
  })
  .catch(error => console.log(error.message));

extractHostname("https://stackoverflow.com")
  .then(result => {
    //returns stackoverflow.com
    console.log("Hostname: ", result);
  })
  .catch(error => console.log(error.message));

extractRootDomain("https://stackoverflow.com")
  .then(result => {
    //returns stackoverflow.com
    console.log("RootDomain: ", result);
  })
  .catch(error => console.log(error.message));

Built With

Contributing

Please read [CONTRIBUTING.md] under docs for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

I use SemVer for versioning. For the versions available, see the tags on this repository.

Author

  • Ehtasham Ali

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

emoji-log

Connect

GitHub @EhtashamAli (follow)

LinkedIn @ehtashamali786 (connect)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •