Skip to content

StArRy5211/egg-ip-search

Repository files navigation

egg-ip-search

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Install

$ npm i egg-ip-search --save

Usage

// {app_root}/config/plugin.js
exports.ipSearch = {
  enable: true,
  package: 'egg-ip-search',
};
// {app_root}/controller/xxx.js
const location = await this.ctx.getLocation();
const location = await this.ctx.getLocationByIP('223.71.87.228');

Example

const location = await this.ctx.getLocationByIP('223.71.87.228'); // { province: "北京", city: "北京", isp: "中国移动北京分公司" }

Questions & Suggestions

Please open an issue here.

License

MIT

About

egg plugin for searching ip geo information.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published