magnet-google-maps
v2.0.0
Published
Readme
Downloads
20
Readme
Usage
All api should refer Google Maps
Basic
import magnet from 'magnet-core';
import Config from 'magnet-config';
import Logger from 'magnet-bunyan';
import Koa from 'magnet-koa';
import Session from 'magnet-session';
import Router from 'magnet-router';
import GoogleMaps from 'magnet-google-maps';
let app = await magnet([Config, Logger, Koa, Session, Router, GoogleMaps]);
server/controllers/user.js
export default function user({ router, googleMaps }) {
router
.get('/users', async function (ctx) {
ctx.body = await googleMaps.placesAutoComplete({
location: [0, 0],
radius: 20000000,
type: '(cities)',
input: 'Gotham'
}).asPromise()
});
}