summaryrefslogtreecommitdiffstats
path: root/server.py
diff options
context:
space:
mode:
Diffstat (limited to 'server.py')
-rw-r--r--server.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/server.py b/server.py
index 6786125..25d2826 100644
--- a/server.py
+++ b/server.py
@@ -6,14 +6,15 @@ from lib import run_server, get, post, read_html
grid = None
nodes = None
-
+unconnected_nodes = None
@get('/')
def index():
global nodes
global grid
+ global unconnected_nodes
- nodes, grid = store.extract_osm_nodes("university.osm")
+ nodes, grid, unconnected_nodes = store.extract_osm_nodes("university.osm")
return read_html('templates/index.html')
@@ -37,6 +38,12 @@ def favicon():
return image_bytes
+@get('/show-unconnected-nodes')
+def show_unconnected_nodes():
+ print(f"Showing {len(unconnected_nodes)} unconnected nodes")
+ return json.dumps({node.id: node.coord_tuple() for node in unconnected_nodes})
+
+
@post('/shortest-path')
def shortest_path(body):
body = json.loads(body)