🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@stouder-io/adonis-geolite2

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stouder-io/adonis-geolite2

Maxmind's GeoLite2 integration for Adonis

latest
Source
npmnpm
Version
2.1.3
Version published
Maintainers
1
Created
Source

@stouder-io/adonis-geolite2

Maxmind's GeoLite2 integration for Adonis

npm

This package uses geolite2-redist and thus, you MUST comply with it specific conditions. For more information please check their npm page.

Installation

node ace add @stouder-io/adonis-geolite2

Alternatively, you can install it manually.

npm i @stouder-io/adonis-geolite2

If installed manually, you need to manually run the configuration command.

node ace configure @stouder-io/adonis-geolite2

Usage

The geolite2 is automatically attached to HTTP requests, allowing you to use it to retrieves informations about the geolocation of requesting IPs.

router.get('/', ({ geolite2 }: HttpContext) => {
  const country = geolite2.country()
  const city = geolite2.city()
  const asn = geolite2.asn()

  return { country, city, asn }
})

If no parameter is provided to the functions, it uses request.ip(). Alternatively you can pass the IP you want to lookup.

router.get('/', ({ geolite2 }: HttpContext) => {
  const country = geolite2.country('8.8.8.8')
  const city = geolite2.city('8.8.8.8')
  const asn = geolite2.asn('8.8.8.8')

  return { country, city, asn }
})

Keywords

adonisjs

FAQs

Package last updated on 07 Feb 2026

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