Page Contents

Synopsis

Adds a new empty controller to a LoopBack application.

lb4 controller [options] [<name>]

Options

Standard options

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

Arguments

<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.

Output

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.