mirror of
https://github.com/italicsjenga/handlebars-ipinfo.git
synced 2024-11-23 21:11:31 +11:00
Add helpers to return geoinfo
This commit is contained in:
parent
8e4ecd3773
commit
04151271c8
11
index.ts
11
index.ts
|
@ -13,7 +13,16 @@ app.set('view engine', 'handlebars');
|
|||
|
||||
app.get('/', function (req, res) {
|
||||
getIpInfo("::ffff:" + "119.17.156.106").done(function (geoinfo: IPGeoJson) {
|
||||
res.render('home');
|
||||
res.render('home', {
|
||||
helpers: {
|
||||
ip: function() { return geoinfo.ip; },
|
||||
city: function() { return geoinfo.city; },
|
||||
region: function() {return geoinfo.region; },
|
||||
country: function() { return geoinfo.country; },
|
||||
loc: function() { return geoinfo.loc; },
|
||||
postal: function() { return geoinfo.postal }
|
||||
}
|
||||
});
|
||||
}); //replace with req.ip
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue