Skip to content
Permalink
Browse files

Replaced iplocation package with node-iplocate

  • Loading branch information...
omgimanerd committed Mar 1, 2019
1 parent 8b100e3 commit ab43288333cf070ac3af23e444e44d576f3ea5b6
Showing with 46 additions and 20 deletions.
  1. +42 −16 package-lock.json
  2. +1 −1 package.json
  3. +3 −3 server.js

Some generated files are not rendered by default. Learn more.

@@ -13,12 +13,12 @@
"colors": "^1.1.2",
"express": "^4.16.4",
"express-winston": "^2.6.0",
"iplocation": "^6.1.0",
"moment": "^2.18.1",
"moment-timezone": "^0.5.23",
"mongodb": "^3.1.13",
"nanoid": "^2.0.1",
"newsapi": "^2.4.0",
"node-iplocate": "^1.0.1",
"winston": "^2.4.4"
},
"devDependencies": {
@@ -17,9 +17,9 @@ const INTERNAL_ERROR = '\nAn error occurred! Please try again in a bit.\n'
// eslint-disable-next-line no-unused-vars
const colors = require('colors')
const express = require('express')
const iplocation = require('iplocation').default
const moment = require('moment-timezone')
const mongodb = require('mongodb')
const iplocate = require('node-iplocate')
const newsapi = require('newsapi')
const path = require('path')

@@ -81,8 +81,8 @@ app.get('/:query', async(request, response) => {
articles.forEach((article, i) => { article.url = shortenedUrls[i] })
let timezone = null
try {
const locationData = await iplocation(request.headers['x-forwarded-for'])
timezone = locationData.timezone
const locationData = await iplocate(request.headers['x-forwarded-for'])
timezone = locationData.time_zone
} catch (error) {
timezone = moment.tz.guess()
}

0 comments on commit ab43288

Please sign in to comment.
You can’t perform that action at this time.