Adds a new class to aLoopBack application.
- Name of the interceptor to create as an argument to the command. Ifprovided, the tool will use that as the default when it prompts for the name.
—global
- Optional flag to indicate a global interceptor (default to ).Use —no-global
to set it to .
The tool will prompt you for:
Name of the interceptor.(interceptorName) If the name had been suppliedfrom the command line, the prompt is skipped.
Is it a global interceptor.(isGlobal) If the flag had been suppliedfrom the command line, the prompt is skipped.
Once all the prompts have been answered, the CLI will do the following:
- Create an interceptor class as follows:
Update
/src/interceptors/index.ts
to export the newly created globalinterceptor class.The generated class looks like:
- A non-global interceptor