Page Contents


Adds a new empty controller to a LoopBack application.

lb4 controller [options] [<name>]


Standard options

-h, --help
Print the generator’s options and usage.
Do not remember prompt answers. Default is false.
Do not automatically install dependencies. Default is false.


<name> - Optional name of the controller to create as an argument to the command.  If provided, the tool will use that as the default when it prompts for the name.

Interactive Prompts

The tool will prompt you for:

  • Name of the controller. If the name had been supplied from the command line, the prompt is skipped and the controller is built with the name from the command-line argument.


The tool will create a new file as /src/controllers/controller-name.controller.ts. The file will contain an empty constructor and common package imports that can be uncommented.