Added geo ipcode
This commit is contained in:
parent
287a7529a6
commit
6f5f094082
4 changed files with 20 additions and 0 deletions
|
|
@ -40,3 +40,4 @@ gadicc:blaze-react-component # Add braze to react
|
||||||
mixmax:smart-disconnect # Disconnect on lost focus
|
mixmax:smart-disconnect # Disconnect on lost focus
|
||||||
flowkey:raven # js errors
|
flowkey:raven # js errors
|
||||||
davidsichau:piwik # Stats
|
davidsichau:piwik # Stats
|
||||||
|
thebakery:ipgeocoder
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ templating@1.3.2
|
||||||
templating-compiler@1.3.3
|
templating-compiler@1.3.3
|
||||||
templating-runtime@1.3.2
|
templating-runtime@1.3.2
|
||||||
templating-tools@1.1.2
|
templating-tools@1.1.2
|
||||||
|
thebakery:ipgeocoder@0.1.2
|
||||||
themeteorchef:bert@2.1.3
|
themeteorchef:bert@2.1.3
|
||||||
tmeasday:check-npm-versions@0.3.1
|
tmeasday:check-npm-versions@0.3.1
|
||||||
tracker@1.1.3
|
tracker@1.1.3
|
||||||
|
|
|
||||||
17
imports/startup/server/geolocation.js
Normal file
17
imports/startup/server/geolocation.js
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { Meteor } from 'meteor/meteor';
|
||||||
|
|
||||||
|
// https://atmospherejs.com/thebakery/ipgeocoder
|
||||||
|
Meteor.startup(function(){
|
||||||
|
IPGeocoder.load();
|
||||||
|
});
|
||||||
|
|
||||||
|
Meteor.methods({
|
||||||
|
geo: function() {
|
||||||
|
// https://stackoverflow.com/questions/14843232/how-to-get-the-user-ip-address-in-meteor-server/22657421#22657421
|
||||||
|
clientIP = this.connection.clientAddress;
|
||||||
|
console.log(clientIP);
|
||||||
|
var geoData = IPGeocoder.geocode('82.124.236.10');
|
||||||
|
console.log(JSON.stringify(geoData));
|
||||||
|
return geoData;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
@ -2,3 +2,4 @@ import './accounts';
|
||||||
import './api';
|
import './api';
|
||||||
import './fixtures';
|
import './fixtures';
|
||||||
import './email';
|
import './email';
|
||||||
|
import './geolocation';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue