try: import uasyncio as asyncio except ImportError: import asyncio from microdot_asyncio import Microdot, Response app = Microdot() htmldoc = ''' Microdot Example Page

Microdot Example Page

Hello from Microdot!

Click to shutdown the server

''' @app.route('/') async def hello(request): return Response(body=htmldoc, headers={'Content-Type': 'text/html'}) @app.route('/shutdown') async def shutdown(request): request.app.shutdown() return 'The server is shutting down...' app.run(debug=True)