Skip to content

Commit

Permalink
Using cors-enabled proxy
Browse files Browse the repository at this point in the history
Fixes #1
  • Loading branch information
anvaka committed Feb 21, 2015
1 parent 83fb0a3 commit d45e581
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/scripts/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports.registryUrl = 'http://npm-cors-proxy.herokuapp.com/registry/_design/scratch/_view/byField';
4 changes: 2 additions & 2 deletions src/scripts/navbar/controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = require('an').controller(navbarController);
var registryUrl = require('../config.js').registryUrl;

function navbarController($scope, $http, $routeParams, $location) {
$scope.formatPkg = function (model) {
Expand All @@ -23,11 +24,10 @@ function navbarController($scope, $http, $routeParams, $location) {
};

$scope.getPackages = function(val) {
return $http.jsonp('http://isaacs.iriscouch.com/registry/_design/scratch/_view/byField', {
return $http.get(registryUrl, {
params: {
limit: 10,
reduce: false,
callback: 'JSON_CALLBACK',
startkey: JSON.stringify(val)
}
}).then(function(res){
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/viewer/graphBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
* Creates a graph for a give package name
*/
var createGraphBuilder = require('npmgraphbuilder');
var registryUrl = require('../config.js').registryUrl;

module.exports = function (pkgName, http, changed) {
var graph = require('ngraph.graph')();

var graphBuilder = createGraphBuilder(function (url, data) {
data.callback = 'JSON_CALLBACK';
return http.jsonp(url, {params: data});
});
return http.get(url, {params: data});
}, registryUrl);

graph.on('changed', pinRootNode);

Expand Down

0 comments on commit d45e581

Please sign in to comment.