# nest-geoip2

> MaxMind GeoIP2 module for Nest framework.

Latest version **1.2.2** (published 2023-01-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install nest-geoip2
pnpm add nest-geoip2
yarn add nest-geoip2
bun add nest-geoip2
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2023-01-16 |
| First published | 2020-01-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 34.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Xudong Huang |
| Maintainers | xudong |
| Keywords | nest, nestjs, geoip2, maxmind |

## Links

- npm: https://www.npmjs.com/package/nest-geoip2
- Repository: https://github.com/xudongdev/nest-geoip2
- Homepage: https://github.com/xudongdev/nest-geoip2#readme
- Issues: https://github.com/xudongdev/nest-geoip2/issues
- npm.io page: https://npm.io/package/nest-geoip2

## Recent versions

- 1.2.2 (latest) — 2023-01-16
- 1.2.1 — 2021-09-16
- 1.2.0 — 2021-09-16
- 1.1.1 — 2020-03-27
- 1.1.0 — 2020-03-25
- 1.0.5 — 2020-03-08
- 1.0.4 — 2020-02-23
- 1.0.3 — 2020-01-07
- 1.0.2 — 2020-01-03
- 1.0.1 — 2020-01-03
- 1.0.0 — 2020-01-03

## README

# nest-geoip2

[![Build Status](https://img.shields.io/github/workflow/status/xudongdev/nest-geoip2/Node.js%20CI)](https://github.com/xudongdev/nest-geoip2/actions?query=workflow%3A%22Node.js+CI%22)
[![Coverage Status](https://img.shields.io/codecov/c/github/xudongdev/nest-geoip2)](https://codecov.io/github/xudongdev/nest-geoip2)
[![License](https://img.shields.io/npm/l/nest-geoip2)](https://www.npmjs.com/package/nest-geoip2)
[![Version](https://img.shields.io/npm/v/nest-geoip2)](https://www.npmjs.com/package/nest-geoip2)
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
![Dependabot](https://badgen.net/dependabot/thepracticaldev/dev.to?icon=dependabot)

MaxMind GeoIP2 module for Nest framework.

## Install

```javascript
npm i nest-geoip2 @maxmind/geoip2-node
// or
yarn add nest-geoip2 @maxmind/geoip2-node
```

## Usage

```typescript
// app.module.ts
import { Module } from "@nestjs/common";
import { GeoIP2Module } from "nest-geoip2";
import { join } from "path";

import { AppController } from "./app.controller.ts";

@Module({
  imports: [
    GeoIP2Module.registerRender(join(process.cwd(), "GeoLite2-City.mmdb")),
  ],
  controllers: [AppController],
})
export class AppModule {}
```

```typescript
// app.controller.ts
import { Controller, Get, Ip } from "@nestjs/common";
import { ReaderModel } from "nest-geoip2";

@Controller()
export class AppController {
  public constructor(private readonly readerModel: ReaderModel) {
    return this;
  }

  @Get("ip")
  public async ip(@Ip() ip: string) {
    return this.readerModel.city(ip);
  }
}
```

## Other

How to get GeoIP2/GeoLite2 database?  
[https://dev.maxmind.com/geoip/geoipupdate/#Direct_Downloads](https://dev.maxmind.com/geoip/geoipupdate/#Direct_Downloads)  
[https://www.maxmind.com/en/accounts/current/geoip/downloads](https://www.maxmind.com/en/accounts/current/geoip/downloads)

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