Commit ·
f40115c
1
Parent(s): eefdb3e
Addition of Middlewares - Fix
Browse files
FileStream/server/API/__init__.py
CHANGED
|
@@ -15,25 +15,24 @@ from .uploads import upload_file
|
|
| 15 |
|
| 16 |
|
| 17 |
#-----------------------------Functions------------------------#
|
| 18 |
-
|
| 19 |
-
allow_credentials=False,
|
| 20 |
-
expose_headers="*",
|
| 21 |
-
allow_headers="*",
|
| 22 |
-
allow_methods="*"
|
| 23 |
-
)})
|
| 24 |
-
|
| 25 |
-
|
| 26 |
async def handle_v2(request):
|
| 27 |
return web.Response(text="Hello from app api!")
|
| 28 |
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
-
#---------------------------Routes ---------------------------#
|
| 35 |
-
# Web server setup with optimized CORS handling
|
| 36 |
-
api = web.Application()
|
| 37 |
|
| 38 |
|
| 39 |
cors.add(api.router.add_get('/', handle_v2))
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
#-----------------------------Functions------------------------#
|
| 18 |
+
#CORS is only configured to Handle V2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
async def handle_v2(request):
|
| 20 |
return web.Response(text="Hello from app api!")
|
| 21 |
|
| 22 |
+
#---------------------------Routes ---------------------------#
|
| 23 |
+
# Web server setup with optimized CORS handling
|
| 24 |
+
api = web.Application()
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
+
cors = aiohttp_cors.setup(api, defaults={"*": aiohttp_cors.ResourceOptions(
|
| 30 |
+
allow_credentials=False,
|
| 31 |
+
expose_headers="*",
|
| 32 |
+
allow_headers="*",
|
| 33 |
+
allow_methods="*"
|
| 34 |
+
)})
|
| 35 |
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
|
| 38 |
cors.add(api.router.add_get('/', handle_v2))
|