INNER CODE UNIT · Python
add_sink
falconry/falcon · falcon/app.py:801
def add_sink(
self, sink: SinkCallable[_ReqT, _RespT], prefix: SinkPrefix = r'/'
) -> None:
"""Register a sink method for the App.
If no route matches a request, but the path in the requested URI
matches a sink prefix, Falcon will pass control to the
associated sink, regardless of the HTTP method requested.
Using sinks, you can drain and dynamically handle a large number
of routes, when creating static resources and responders would be
impractical. For example, you might use a sink to create a smart
proxy that forwards requests to one or more backend services.
Note:
To support CORS preflight requests when using the default CORS middleware,
either by setting ``App.cors_enable=True`` or by adding the
:class:`~.CORSMiddleware` to the ``App.middleware``, the sink should