Skip to content

Commit

Permalink
Cleaning up requests to get her running neat again.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomcom committed Jun 23, 2022
1 parent 35442fa commit d8149dc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
20 changes: 12 additions & 8 deletions examples/extra-large-graphs/gpu-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,36 @@ async function request(obj) {
});
}

const SERVER = 'http://localhost:3000';
const SERVER = 'http://localhost:3010';
const DATASET_ROUTE = '/graphology/read_large_demo?filename=../../public/fewer-edges.json';
const NODES_ROUTE = '/graphology/get_column/nodes';
const NODES_BOUNDS_ROUTE = '/graphology/nodes/bounds';
const NODES_BUFFER_ROUTE = '/graphology/nodes/';
const EDGES_BUFFER_ROUTE = '/graphology/edges/';
const NODES_BUFFER_ROUTE = '/graphology/nodes';
const EDGES_BUFFER_ROUTE = '/graphology/edges';
const TABLE_ROUTE = '/graphology/get_table';

const GpuLoader = {
init: async () => request(SERVER + DATASET_ROUTE),
init: async () => request({method: 'POST', url: SERVER + DATASET_ROUTE, mode: 'no-cors'}),
getTable: async (table) => {
return arrow.tableFromIPC(fetch(SERVER + TABLE_ROUTE + '/' + table, {method: 'GET'}));
const result = await fetch(SERVER + TABLE_ROUTE + '/' + table, {method: 'GET', headers: {'Access-Control-Allow-Origin': '*'}})
return arrow.tableFromIPC(result);
},
getColumn: async (table, column) => {
const table_route = {'nodes': '/graphology/get_column/nodes/'}[table];
const column_route = SERVER + table_route + column;
return arrow.tableFromIPC(fetch(column_route, {method: 'GET'}));
const result = await fetch(column_route, {method: 'GET', headers: {'Access-Control-Allow-Origin': '*'}});
return arrow.tableFromIPC(result);
},
getNodesBounds: async () => request(SERVER + NODES_BOUNDS_ROUTE),
getNodesBuffer: async () => {
const route = SERVER + NODES_BUFFER_ROUTE;
return arrow.tableFromIPC(fetch(route, {method: 'GET'}));
const result = await fetch(route, {method: 'GET', headers: {'Access-Control-Allow-Origin': '*'}});
return arrow.tableFromIPC(result);
},
getEdgesBuffer: async () => {
const route = SERVER + EDGES_BUFFER_ROUTE;
return arrow.tableFromIPC(fetch(route, {method: 'GET'}));
const result = await fetch(route, {method: 'GET', headers: {'Access-Control-Allow-Origin': '*'}});
return arrow.tableFromIPC(result);
}
};

Expand Down
7 changes: 2 additions & 5 deletions examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"build": "npm run clean && ./build.js build",
"clean": "rimraf build",
"start": "kotatsu serve $npm_config_example/index.ts --index $npm_config_example/index.html --public / $npm_config_example/public --port 3002"
"start": "kotatsu serve $npm_config_example/index.ts --index $npm_config_example/index.html --public / $npm_config_example/public"
},
"kotatsu": {
"config": "webpack.config.js"
Expand All @@ -26,13 +26,10 @@
"graphology-layout": "^0.5.0",
"graphology-layout-force": "^0.2.3",
"graphology-layout-forceatlas2": "^0.8.1",
"graphology-types": "^0.23.0",
"iwanthue": "^1.5.1",
"papaparse": "^5.3.1",
"seedrandom": "^3.0.5",
"uuid": "^8.3.2",
"request": "latest"

"uuid": "^8.3.2"
},
"devDependencies": {
"async": "^3.2.2",
Expand Down

0 comments on commit d8149dc

Please sign in to comment.