Skip to content

Instantly share code, notes, and snippets.

View eldarc's full-sized avatar

Eldar eldarc

View GitHub Profile
{
"country":"BA",
"region":"bih",
"city":"sarajevo",
"cityLatLong":"43.856259,18.413076",
"userIP":"0.0.0.0",
"cityData":[
{
"city":"Sarajevo",
"city_ascii":"Sarajevo",
const cors = require('cors')
const cityTimezones = require('city-timezones');
// Set `useWhitelist` to `false` if you want to accept all requests.
const config = {
useWhitelist: false
}
// Define from which origins requests are allowed.
const whitelist = [
{
"name": "gfc-geolocation",
"version": "0.0.1",
"dependencies": {
"cors": "^2.8.4",
"city-timezones": "^1.0.5"
}
}
const cors = require('cors')
// Set `useWhitelist` to `false` if you want to accept all requests.
const config = {
useWhitelist: true
}
// Define from which origins requests are allowed.
const whitelist = [
// 'https://fiddle.jshell.net',
{
"country":"BA",
"region":"bih",
"city":"sarajevo",
"cityLatLong":"43.856259,18.413076",
"userIP":"0.0.0.0"
}
{
"name": "gfc-geolocation",
"version": "0.0.1",
"dependencies": {
"cors": "^2.8.4"
}
}
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"]
}