diff --git a/examples/extra-large-graphs/gpu-loader.ts b/examples/extra-large-graphs/gpu-loader.ts index 6096ee504..ffb6f6648 100644 --- a/examples/extra-large-graphs/gpu-loader.ts +++ b/examples/extra-large-graphs/gpu-loader.ts @@ -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); } }; diff --git a/examples/package.json b/examples/package.json index a6dfde706..f7cb64f52 100644 --- a/examples/package.json +++ b/examples/package.json @@ -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" @@ -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",