Skip to content

Instantly share code, notes, and snippets.

@ovnicraft
Last active December 7, 2016 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ovnicraft/86a58ff61438ff518415a6208a2efac0 to your computer and use it in GitHub Desktop.
Save ovnicraft/86a58ff61438ff518415a6208a2efac0 to your computer and use it in GitHub Desktop.
import asyncio
from aiohttp import web
from routers import routers
from aiohttp_session.cookie_storage import EncryptedCookieStorage
import aiohttp_cors
loop = asyncio.get_event_loop()
app = web.Application(loop=loop)
aiohttp_cors.setup(app, defaults={
'http://localhost:3000': aiohttp_cors.ResourceOptions(
allow_methods=['GET'],
expose_headers='*',
allow_headers='*'
)
})
for router in routers:
app.router.add_route(router[0], router[1], router[2], name=router[3])
web.run_app(app)
@asvetlov
Copy link

asvetlov commented Dec 7, 2016

There is no Cross Origin in your case: all your code is executed on local host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment