# *Py - simple aio microdot webserver serving index.html
# Copyright by Anthony Vogelaar, Perth Scotland
# rev 0.10  2025-11-26  initial release

import	asyncio
from	microdot	import	Microdot, send_file

# ==================== webserver ========================

app = Microdot()

@app.route('/')
async def index(request):
    return send_file('index.html')

# ======================= main ==========================

# Three cooperative asyncio tasks
#    task #1: webserver
#    task #2: print '*' @ 1 Hz
async def main():
    asyncio.create_task(app.start_server(debug=True))	# task #1
    while True:											# task #2
        await asyncio.sleep(1)
        print('*', end='')


asyncio.run(main())
    
# ======================== end ===========================
