diff options
| author | Gustav Sörnäs <gusso230@student.liu.se> | 2020-12-15 17:52:58 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gusso230@student.liu.se> | 2020-12-15 17:52:58 +0100 |
| commit | 6c8acb4f4eabb20da41b941158bf52038035699f (patch) | |
| tree | ef680ba06131b77d82b6dafc3c9750b58b256c14 /server.py | |
| parent | ace809ebf6f38b1d4fc9f4ec59890d738b7ca583 (diff) | |
| parent | 21a531eac5b953aeab14e4e8ae887695e8a4c4aa (diff) | |
| download | tdde25-6c8acb4f4eabb20da41b941158bf52038035699f.tar.gz | |
Merge remote-tracking branch 'origin/union-find'
Diffstat (limited to 'server.py')
| -rw-r--r-- | server.py | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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) |
