Page Contents

Home > @loopback/core > Application > interceptor

Application.interceptor() method

Register an interceptor

Signature:

interceptor(interceptor: Interceptor | Constructor<Provider<Interceptor>>, nameOrOptions?: string | InterceptorBindingOptions): Binding<Interceptor>;

Parameters

Parameter Type Description
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
nameOrOptions string \| [InterceptorBindingOptions](/doc/en/lb4/apidocs.context.interceptorbindingoptions.html) _(Optional)_ Binding name or options

Returns:

Binding<Interceptor>