1.0.2 • Published 7 months ago

@allainpatinho/log-tracker v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

my-js-library/my-js-library/README.md

My JS Library

Overview

My JS Library provides a simple way to log the user's IP address. It includes the IPLogger class, which fetches the user's IP address and can optionally send it to a specified backend service.

Installation

To install the library, you can use npm:

npm install my-js-library

Usage

To use the IPLogger class in your project, you can import it as follows:

import IPLogger from 'my-js-library/src/ipLogger.js';

Example

Here is a simple example of how to use the IPLogger class:

const logger = new IPLogger('https://your-backend-service.com/log-ip');
logger.logIP();

In this example, the logIP method fetches the user's IP address and logs it to the console. If a service URL is provided, it will also send the IP address to that URL.

Methods

fetchIP()

  • Fetches the user's IP address from an external API.

logIP()

  • Logs the user's IP address to the console.
  • Optionally sends the IP address to a specified service URL if provided.

Contributing

If you would like to contribute to this project, please fork the repository and submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

1.0.2

7 months ago

1.0.1

8 months ago

1.0.0

8 months ago