alexarank

A simple node package to get Alexa traffic rank for a domain or URL
Log | Files | Refs | README | LICENSE

commit 44481c5a4ee0baefd6516630c6c7a45448397e8c
parent 627c42ba657e36111c40f62b522809e873362099
Author: Jannis R <mail@jannisr.de>
Date:   Fri, 21 Oct 2016 20:54:25 +0200

various fixes

- ignore node_modules
- strict mode
- updated dependencies, use semver range
- encode URL
- add latest Node.js versions to Travis
- `files` whitelist in `package.json`

Diffstat:
A.gitignore | 1+
M.travis.yml | 9+++++----
Mindex.js | 2++
Mlib/alexarank.js | 4+++-
Mpackage.json | 5+++--
5 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/.travis.yml b/.travis.yml @@ -1,6 +1,7 @@ language: node_js node_js: - - "0.10" - - "0.12" - - "4.0" - - "4.1" + - '0.10' + - '0.12' + - '4' + - '6' + - 'stable' diff --git a/index.js b/index.js @@ -1 +1,3 @@ +'use strict' + module.exports = require('./lib/alexarank'); diff --git a/lib/alexarank.js b/lib/alexarank.js @@ -1,3 +1,5 @@ +'use strict' + /*****************************************************************************/ /* */ /* alexarank 0.1.1 */ @@ -16,7 +18,7 @@ var request = require('request'); var xml2js = require('xml2js'); module.exports = function(url, callback) { - request('http://data.alexa.com/data?cli=10&url=' + url, function(error, response, body) { + request('https://data.alexa.com/data?cli=10&url=' + encodeURIComponent(url), function(error, response, body) { if (error) { callback(new Error('Cannot reach Alexa API')); } else if (response.statusCode != 200) { diff --git a/package.json b/package.json @@ -2,6 +2,7 @@ "name": "alexarank", "version": "0.1.1", "description": "A simple node package to get Alexa traffic rank for a domain or URL", + "files": ["index.js", "lib", "bin"], "main": "index.js", "bin": { "alexarank": "./bin/alexarank" @@ -31,8 +32,8 @@ "url": "https://github.com/fcambus/alexarank/issues" }, "dependencies": { - "xml2js": "0.4.15", - "request": "2.67.0" + "xml2js": "^0.4", + "request": "^2.75" }, "devDependencies": { "mocha": "2.3.4",