Skip to content

Instantly share code, notes, and snippets.

@theruziev
Created March 7, 2019 12:33
Show Gist options
  • Save theruziev/c97e5e51a9f7393a7e29c5d17a098a1f to your computer and use it in GitHub Desktop.
Save theruziev/c97e5e51a9f7393a7e29c5d17a098a1f to your computer and use it in GitHub Desktop.
main.py
from aiohttp import web
async def handle(request):
name = request.match_info.get('name', "Anonymous")
text = "Hello, " + name
return web.Response(text=text)
app = web.Application()
app.add_routes([web.get('/', handle),
web.get('/{name}', handle)])
app.router.add_static("/prefix", "./static")
if __name__ == '__main__':
web.run_app(app)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment