Last active
July 7, 2018 13:38
-
-
Save eldarc/2271fa18e00a6b1a41c4d6524c44d0b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const cors = require('cors') | |
| function _geolocation(req, res) { | |
| const data = { | |
| country: req.headers["x-appengine-country"], | |
| region: req.headers["x-appengine-region"], | |
| city: req.headers["x-appengine-city"], | |
| cityLatLong: req.headers["x-appengine-citylatlong"], | |
| userIP: req.headers["x-appengine-user-ip"] | |
| } | |
| res.json(data) | |
| }; | |
| exports.geolocation = (req, res) => { | |
| const corsHandler = cors({ origin: true }) | |
| return corsHandler(req, res, function() { | |
| return _geolocation(req, res); | |
| }); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment