Spaces:
Running
Running
File size: 746 Bytes
e566133 e1056a6 e566133 e1056a6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
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
)
})
|