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](/doc/en/lb4/apidocs.context.context.html) Context object
interceptor [Interceptor](/doc/en/lb4/apidocs.context.interceptor.html) \| [Constructor](/doc/en/lb4/apidocs.context.constructor.html)<[Provider](/doc/en/lb4/apidocs.context.provider.html)<[Interceptor](/doc/en/lb4/apidocs.context.interceptor.html)>> An interceptor function or provider class
options [InterceptorBindingOptions](/doc/en/lb4/apidocs.context.interceptorbindingoptions.html) _(Optional)_ Options for the interceptor binding

Returns:

Binding<Interceptor>