Page Contents

Home > @loopback/context > registerInterceptor

registerInterceptor() function

Register an interceptor function or provider class to the given context

Signature:

export declare function registerInterceptor(ctx: Context, interceptor: Interceptor | Constructor<Provider<Interceptor>>, options?: InterceptorBindingOptions): Binding<Interceptor>;

Parameters

Parameter Type Description
ctx Context Context object
interceptor Interceptor | Constructor<Provider<Interceptor>> An interceptor function or provider class
options InterceptorBindingOptions (Optional) Options for the interceptor binding

Returns:

Binding<Interceptor>