teleapi / FileStream /server /__init__.py
BinaryONe
Added CORS for /tmdb/movies
e1056a6
raw
history blame
746 Bytes
from aiohttp import web
import aiohttp_cors
from .routes_main import routes
from .routes_api import api
from .routes_app import sub_app
async def root_route_handler(request):
return web.json_response({"status": "alive", "message": "Server is running"})
def web_server():
web_app = web.Application(client_max_size=500)
web_app.router.add_get('/', root_route_handler)
web_app.add_routes(routes)
web_app.add_subapp('/app', sub_app)
web_app.add_subapp('/api', api)
return web_app
cors = aiohttp_cors.setup(app, defaults={
"*": aiohttp_cors.ResourceOptions(
allow_credentials=True,
expose_headers="*",
allow_headers="*",
allow_methods=["GET"] # Allowing specific methods
)
})