# client-request-inspector

> A Node.js library designed for efficient server-side extraction of client request data, providing easy access to client information such as IP address, browser type and location

Latest version **1.0.0** (published 2023-11-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install client-request-inspector
pnpm add client-request-inspector
yarn add client-request-inspector
bun add client-request-inspector
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-11-22 |
| First published | 2023-11-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 63.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Iheb MEJRI |
| Maintainers | iheb_mejri |
| Keywords | node, request, client-data, extraction, ip-address, browser-type, location |

## Links

- npm: https://www.npmjs.com/package/client-request-inspector
- Repository: https://github.com/iheb15M/client-request-inspector
- Homepage: https://github.com/iheb15M/client-request-inspector#readme
- Issues: https://github.com/iheb15M/client-request-inspector/issues
- npm.io page: https://npm.io/package/client-request-inspector

## Dependencies (2)

- [maxmind](https://npm.io/package/maxmind.md) ^4.3.17
- [@maxmind/geoip2-node](https://npm.io/package/@maxmind/geoip2-node.md) ^4.2.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2023-11-22
- 0.0.1 — 2023-11-21

## README

# client-request-inspector

![npm](https://img.shields.io/npm/v/client-request-inspector)
![npm](https://img.shields.io/npm/dt/client-request-inspector)
![NPM](https://img.shields.io/npm/l/client-request-inspector)
[![Coverage](https://github.com/iheb15M/client-request-inspector/actions/workflows/coverage.yml/badge.svg)](https://github.com/iheb15M/client-request-inspector/actions/workflows/coverage.yml)

## Overview

`client-request-inspector` is a Node.js library designed for efficient server-side extraction of client data,
providing easy access to information such as `IP address`, `browser type`, and `location` to enhance the development experience for seamless web applications.


## Features

- Server-side client data extraction
- Support for IP address, browser type, and location
- Designed for use in web development projects
- Seamless integration with Express.js 


> [!TIP]
> To test the lib locally use [ngrok](https://ngrok.com/)

## Installation

You can install `client-request-inspector` via npm or yarn. 

```bash
npm install client-request-inspector
# or
yarn add client-request-inspector
```
## Usage
```javascript
const express = require('express');
const app = express();
const port = 3000;

// Import the library
const {clientInspector} = require('client-request-inspector');

app.get('/', async (req, res) => {
    // use client inspector
    const data = await clientInspector(req);
    res.send(data);
});


app.listen(port, () => {
    console.log(`Server is listening at http://localhost:${port}`);
});

```

## Return Type Format

The `clientInspector` function returns an object with the following format:


|  Property  |     Type      |                                    Description                                    |
|:----------:|:-------------:|:---------------------------------------------------------------------------------:|
|     ip     |   `string`    |                             IP address of the client                              |
|  browser   |   `string`    |                     User agent string identifying the browser                     |
|  location  |   `Object`    | Object containing location information (isoCode, country, continent and timezone) |


### Exemple:

```javascript
{
    ip: "197.2.183.18",
        browser: "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0",
        location: {
            isoCode: "TN",
            country: "Tunisia",
            continent: "Africa",
            timeZone: "Africa/Tunis"
    }
}

```

<div align="center">

#### Social Links
[![LinkedIn](https://img.shields.io/badge/LinkedIn-iheb--mejri-blue?style=flat&logo=linkedin)](https://www.linkedin.com/in/iheb-mejri/)
[![GitHub Repo](https://img.shields.io/badge/GitHub-Repo-brightgreen?logo=github)](https://github.com/iheb15M/client-request-inspector)

</div>

---
_Source: https://npm.io/package/client-request-inspector · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
