Socket
Book a DemoInstallSign in
Socket

@eddaic/nestjs-maxmind-geoip2

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eddaic/nestjs-maxmind-geoip2

NestJS Module for MaxMind GeoIP2

latest
Source
npmnpm
Version
4.2.0
Version published
Maintainers
1
Created
Source

nestjs-google-maps

Simple NestJS Module to support a @maxmind/geoip2-node client.

Installation

npm install @eddaic/nestjs-maxmind-geoip2

Usage

Initializing

import { MaxmindGeoip2Module } from '@eddaic/nestjs-maxmind-geoip2';
import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';

@Module({
  imports: [
    MaxmindGeoip2Module.registerAsync({
      imports: [ConfigModule],
      inject: [ConfigService],
      useFactory: (config: ConfigService) => ({
        accountId: config.get('MAXMIND_ACCOUNT_ID'),
        licenseKey: config.get('MAXMIND_LICENSE_KEY'),
      }),
    }),
  ],
  providers: [AppService],
})
export class AppModule {}

Calling

import { MaxmindGeoip2Service } from '@eddaic/nestjs-maxmind-geoip2';
import { Injectable } from '@nestjs/common';

@Injectable()
export class AppService {
  constructor(private readonly geoip: MaxmindGeoip2Service) {}

  helloWorld() {
    const ip = '123.123.123.123';
    const result = this.geoip.client.city(ip);

    // Or use shorthand functions
    const result2 = this.geoip.city(ip);
  }
}

Keywords

nestjs

FAQs

Package last updated on 14 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts