Exemplo n.º 1
0
def create_app(loop):
    app = web.Application(loop=loop)
    app["config"] = {"test": "foo"}
    app.router.add_route('GET', '/', handle)
    add_route(app, multiple_query_params)
    add_route(app, multiply)
    add_route(app, get_id)
    route(app, config)
    route(app, get_optional)
    route(app, body_and_header)
    route(app, error)
    # this should be at the end, to ensure all routes are considered when
    # constructing the handler.
    add_swagger(app, "/swagger.json", "/swagger")
    return app
Exemplo n.º 2
0
def create_app(loop):
    app = web.Application(loop=loop, router=TransmuteUrlDispatcher())
    app["config"] = {"test": "foo"}
    app.router.add_route('GET', '/', handle)
    # the preferred form.
    app.router.add_transmute_route("GET", "/describe_later", describe_later)
    app.router.add_transmute_route("GET", "/multiple_query_params", multiple_query_params)
    # the legacy form should be supported.
    app.router.add_transmute_route(multiply)
    app.router.add_transmute_route(get_id)
    app.router.add_transmute_route(config)
    app.router.add_transmute_route(get_optional)
    # this should be at the end, to ensure all routes are considered when
    # constructing the handler.
    add_swagger(app, "/swagger.json", "/swagger")
    return app
Exemplo n.º 3
0
def create_app(loop):
    app = web.Application(loop=loop, router=TransmuteUrlDispatcher())
    app["config"] = {"test": "foo"}
    app.router.add_route('GET', '/', handle)
    # the preferred form.
    app.router.add_transmute_route("GET", "/describe_later", describe_later)
    app.router.add_transmute_route("GET", "/multiple_query_params",
                                   multiple_query_params)
    # the legacy form should be supported.
    app.router.add_transmute_route(multiply)
    app.router.add_transmute_route(get_id)
    app.router.add_transmute_route(config)
    app.router.add_transmute_route(get_optional)
    # this should be at the end, to ensure all routes are considered when
    # constructing the handler.
    add_swagger(app, "/swagger.json", "/swagger")
    return app
Exemplo n.º 4
0
def add_routes(app):
    # add apis
    add_event_api(app)
    add_statics(app)
    add_swagger(app, "/api/swagger.json", "/api/")