You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
943 B

import os
import asyncio
from aiohttp import web
import aiofiles
dir = os.path.dirname(__file__)
routes = web.RouteTableDef()
app = web.Application()
path=os.path.join(dir, "public"),
async def index(request):
async with, "public", "index.html")) as conn:
return web.Response(text=await, content_type="text/html")
async def data(request):
# Obrir una conexió amb base de dates
# Fer la consulta que vulgui definia pels possibles paramatres de la url
file = request.match_info["resource"]
async with, "public", "data", file)) as conn:
return web.Response(text= await, content_type="application/json")
if __name__ == "__main__":