diff --git a/software/src/webserver.py b/software/src/webserver.py index 8e02052..6919a80 100644 --- a/software/src/webserver.py +++ b/software/src/webserver.py @@ -5,7 +5,7 @@ Copyright (c) 2024-2025 Stefan Kratochwil import asyncio -from microdot import Microdot, send_file +from microdot import Microdot, redirect, send_file webapp = Microdot() server = None @@ -27,7 +27,7 @@ async def before_request_handler(request): app.reset_idle_timeout() -@webapp.route('/') +@webapp.route('/api/v1/hello') async def index(request): print("wohoo, a guest :)") print(f" app: {request.app}") @@ -66,12 +66,17 @@ async def config_put(request): return '', 204 +@webapp.route('/', methods=['GET']) +async def root_get(request): + return redirect('/index.html') + + @webapp.route('/index.html', methods=['GET']) async def index_get(request): return send_file('/frontend/index.html.gz', content_type='text/html', compressed='gzip') -@webapp.route('/static/') +@webapp.route('/static/', methods=['GET']) async def static(request, path): if '..' in path: # directory traversal is not allowed