Files
stand/stand/restapi.py
2022-05-28 12:10:33 +02:00

30 lines
569 B
Python

from threading import Thread
import cherrypy as cp
from tblctrl import TableController
# creating instances here allows to use TableAPI etc. as singletons
print(">>> start restapi")
restapi = TableController()
conf = {
"/": {
"request.dispatch": cp.dispatch.MethodDispatcher(),
"tools.sessions.on": True,
"tools.response_headers.on": True,
"tools.response_headers.headers": [("Content-Type", "text/plain")],
}
}
args = (restapi, "/", conf)
thread = Thread(target=cp.quickstart, args=args, daemon=True)
thread.start()