New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@axolo/egg-amap

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axolo/egg-amap

AMap plugin for Egg.js.

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

egg-amap

AMap WEB Service API for Egg.js plugin.

Install

npm i @axolo/egg-amap --save

Usage

// {app_root}/config/plugin.js
exports.amap = {
  enable: true,
  package: '@axolo/egg-amap',
};

Configuration

// {app_root}/config/config.default.js
const axios = require('axios');
exports.amap = {
  // axios: axios.create({ baseURL: 'https://restapi.amap.com' }),
  key: 'AMAP-APP-KEY',
};

see config/config.default.js for more detail.

Example

'use strict';

const Controller = require('egg').Controller;

class AmapController extends Controller {
  async index() {
    const { app, ctx } = this;
    const amap = app.amap; // axios instance
    const { keywords } = ctx.request.query;
    // https://lbs.amap.com/api/webservice/guide/api/newpoisearch
    const result = await amap.get('/v5/place/text', { params: { keywords } });
    ctx.body = result?.data;
  }
}

module.exports = AmapController;

Questions & Suggestions

Please open an issue here.

License

MIT

Keywords

egg

FAQs

Package last updated on 25 Jun 2021

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