1.2.2 • Published 1 year ago

nest-geoip2 v1.2.2

Weekly downloads
2
License
MIT
Repository
github
Last release
1 year ago

nest-geoip2

Build Status Coverage Status License Version Code Style: Prettier Commitizen friendly Semantic Release Dependabot

MaxMind GeoIP2 module for Nest framework.

Install

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

Usage

// 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 {}
// 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://www.maxmind.com/en/accounts/current/geoip/downloads

1.2.2

1 year ago

1.2.0

3 years ago

1.2.1

3 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago