Skip to content

Commit d8149dc

Browse files
committed
Cleaning up requests to get her running neat again.
1 parent 35442fa commit d8149dc

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

examples/extra-large-graphs/gpu-loader.ts

+12-8
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,36 @@ async function request(obj) {
2525
});
2626
}
2727

28-
const SERVER = 'http://localhost:3000';
28+
const SERVER = 'http://localhost:3010';
2929
const DATASET_ROUTE = '/graphology/read_large_demo?filename=../../public/fewer-edges.json';
3030
const NODES_ROUTE = '/graphology/get_column/nodes';
3131
const NODES_BOUNDS_ROUTE = '/graphology/nodes/bounds';
32-
const NODES_BUFFER_ROUTE = '/graphology/nodes/';
33-
const EDGES_BUFFER_ROUTE = '/graphology/edges/';
32+
const NODES_BUFFER_ROUTE = '/graphology/nodes';
33+
const EDGES_BUFFER_ROUTE = '/graphology/edges';
3434
const TABLE_ROUTE = '/graphology/get_table';
3535

3636
const GpuLoader = {
37-
init: async () => request(SERVER + DATASET_ROUTE),
37+
init: async () => request({method: 'POST', url: SERVER + DATASET_ROUTE, mode: 'no-cors'}),
3838
getTable: async (table) => {
39-
return arrow.tableFromIPC(fetch(SERVER + TABLE_ROUTE + '/' + table, {method: 'GET'}));
39+
const result = await fetch(SERVER + TABLE_ROUTE + '/' + table, {method: 'GET', headers: {'Access-Control-Allow-Origin': '*'}})
40+
return arrow.tableFromIPC(result);
4041
},
4142
getColumn: async (table, column) => {
4243
const table_route = {'nodes': '/graphology/get_column/nodes/'}[table];
4344
const column_route = SERVER + table_route + column;
44-
return arrow.tableFromIPC(fetch(column_route, {method: 'GET'}));
45+
const result = await fetch(column_route, {method: 'GET', headers: {'Access-Control-Allow-Origin': '*'}});
46+
return arrow.tableFromIPC(result);
4547
},
4648
getNodesBounds: async () => request(SERVER + NODES_BOUNDS_ROUTE),
4749
getNodesBuffer: async () => {
4850
const route = SERVER + NODES_BUFFER_ROUTE;
49-
return arrow.tableFromIPC(fetch(route, {method: 'GET'}));
51+
const result = await fetch(route, {method: 'GET', headers: {'Access-Control-Allow-Origin': '*'}});
52+
return arrow.tableFromIPC(result);
5053
},
5154
getEdgesBuffer: async () => {
5255
const route = SERVER + EDGES_BUFFER_ROUTE;
53-
return arrow.tableFromIPC(fetch(route, {method: 'GET'}));
56+
const result = await fetch(route, {method: 'GET', headers: {'Access-Control-Allow-Origin': '*'}});
57+
return arrow.tableFromIPC(result);
5458
}
5559
};
5660

examples/package.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"scripts": {
88
"build": "npm run clean && ./build.js build",
99
"clean": "rimraf build",
10-
"start": "kotatsu serve $npm_config_example/index.ts --index $npm_config_example/index.html --public / $npm_config_example/public --port 3002"
10+
"start": "kotatsu serve $npm_config_example/index.ts --index $npm_config_example/index.html --public / $npm_config_example/public"
1111
},
1212
"kotatsu": {
1313
"config": "webpack.config.js"
@@ -26,13 +26,10 @@
2626
"graphology-layout": "^0.5.0",
2727
"graphology-layout-force": "^0.2.3",
2828
"graphology-layout-forceatlas2": "^0.8.1",
29-
"graphology-types": "^0.23.0",
3029
"iwanthue": "^1.5.1",
3130
"papaparse": "^5.3.1",
3231
"seedrandom": "^3.0.5",
33-
"uuid": "^8.3.2",
34-
"request": "latest"
35-
32+
"uuid": "^8.3.2"
3633
},
3734
"devDependencies": {
3835
"async": "^3.2.2",

0 commit comments

Comments
 (0)