18 lines
416 B
Python
18 lines
416 B
Python
|
|
import uasyncio
|
||
|
|
from microdot_asyncio import Microdot
|
||
|
|
|
||
|
|
rest_api = Microdot()
|
||
|
|
|
||
|
|
|
||
|
|
# TODO -- all of these responses aren't REST yet
|
||
|
|
@rest_api.post('/shutdown')
|
||
|
|
async def shutdown(request):
|
||
|
|
uasyncio.create_task(request.app.scheduled_shutdown())
|
||
|
|
return 'Shutting down!\n'
|
||
|
|
|
||
|
|
|
||
|
|
@rest_api.post('/reboot')
|
||
|
|
async def reboot(request):
|
||
|
|
uasyncio.create_task(request.app.scheduled_reboot())
|
||
|
|
return 'Rebooting now!\n'
|