Socket
Socket
Sign inDemoInstall

@renec-foundation/geo-lookup-api

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@renec-foundation/geo-lookup-api

Act as a api route logic or middleware for language lookup


Version published
Maintainers
1
Created
Source

geo-lookup-api

  • Can be used as a middleware / api route for popular frameworks like Next.JS, etc.

Example in Next.JS

Create a file in /pages/api directory, for e.g /pages/api/geo.js

const { handler } = require("@renec-foundation/geo-lookup-api");

const api = async (req, res) => await handler(req, res);

export default api;

request host/api/geo

{ "lang": "vi", "info": { "ip": "42.114.185.210" } }

Utility method:

const { getCountry } = require("@renec-foundation/geo-lookup-api");

getCountry("ip_string");

Run test:

yarn test

Or you can test with a remote database

❯ GEO_DB_URL=https://git.io/GeoLite2-Country.mmdb yarn test
https://github.com/P3TERX/GeoLite.mmdb?tab=readme-ov-file

FAQs

Package last updated on 22 Feb 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc