Skip to main content Link Menu Expand (external link) Document Search Copy Copied

You can add route handlers with either decorator style or app.add_route(). The latter is more suitable in case you are creating an extension.

@app.route('/hello')
async def func(request, **server):
    print('handler')
    return 'Hello, World!'

behaves the same way as:

app.add_route(func, path='/')

The func parameter can be a class type for a CBV usage.