diff options
Diffstat (limited to 'server.py')
| -rw-r--r-- | server.py | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -4,7 +4,6 @@ import algorithms import store from lib import run_server, get, post, read_html - nodes = None @@ -23,11 +22,24 @@ def show_area(): return json.dumps(rect) +@get('/favicon.ico') +def favicon(): + with open("data/favicon.ico", "rb") as image: + read_image = image.read() + image_bytes = bytearray(read_image) + + return image_bytes + + @post('/shortest-path') def shortest_path(body): body = json.loads(body) - source_id = algorithms.get_closest_node_id(nodes, store.Node(-1, body['lat1'], body['lng1'])) - target_id = algorithms.get_closest_node_id(nodes, store.Node(-1, body['lat2'], body['lng2'])) + source_id = algorithms.get_closest_node_id(nodes, + store.Node(-1, body['lat1'], + body['lng1'])) + target_id = algorithms.get_closest_node_id(nodes, + store.Node(-1, body['lat2'], + body['lng2'])) path = algorithms.find_shortest_path(nodes, source_id, target_id) print(path) |
