Skip to content

A Package for adding an extra url with your own prefix to any URL using MongoDB.

Notifications You must be signed in to change notification settings

talha4real/url-masker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

URL Masker

A package for adding an extra URL to provided with your own prefix using MongoDB.

Installation

You can install the package via npm:

npm install url-masker

Usage

First, import the MaskUrl class from the package:

import MaskUrl from "url-masker";

Then, create an instance of MaskUrl by providing the MongoDB connection string and the prefix URL:

const urlMasker = new MaskUrl("mongodb+srv://<username>:<password>@<cluster-address>/<database>","https://example.com");

Next, connect to the MongoDB database:

urlMasker.connectToDatabase()
  .then(() => {
    console.log(urlMasker.urlMasker(<URL_TO_MASK>));
}).catch((error) => {
    console.error("Error connecting to the database:", error);
});

Once you have your new URL, you can simple use the new URL to fetch the Old url.

urlMasker.fetchUrl(<Masked_URL>);

TO-DO

To make this fully work you will have to deploy this on a server with your domain which will redirect to the url.

License

This project is licensed under the MIT License

About

A Package for adding an extra url with your own prefix to any URL using MongoDB.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published