UNKNOWN
Project description
aiohttp_route_decorator
The library provides @route decorator for aiohttp.web.
The imaginary @app.route decorator is discouraged for multiple reasons; this one tries to solve part of those problems (the app doesn’t need to be global at the very least).
Usage
Create a route object in each of your handler modules, and decorate the handlers:
from aiohttp_route_decorator import RouteCollector
route = RouteCollector()
@route('GET', '/', name='index')
async def handler(request):
return web.Response(body=b'OK')
When you init the application, push the collected routes into app.router:
from aiohttp import web
from myapp import handlers
def run():
app = web.Application()
handlers.route.add_to_router(app.router)
web.run_app(app)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for aiohttp_route_decorator-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17c4180e6be9303f917e088367602f1b66dd2e9454e3b8b5f0eefe7decd9e4da |
|
MD5 | 0cc5e29c7019be1b0a962341d2f62ea2 |
|
BLAKE2b-256 | 4cbd037723fb6cd62c6b37abc940c2e2d4b88d67dbb5349cb750b7d734f3d5fc |