Creates a new LoopBack4 application using REST API.
lb4 [app] [options] [<name>]
--applicationName : Application class name.
--description : Description of the application.
--outDir : Project root directory for the application.
--tslint : Add TSLint to LoopBack4 application project.
--prettier : Add Prettier to LoopBack4 application project.
--mocha : Add Mocha to LoopBack4 application project.
--loopbackBuild : Add @loopback/build module’s script set to LoopBack4
--vscode: Add VSCode config files to LoopBack4 application project
- 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 application given as an argument to the
command. If provided, the tool will use that as the default when prompting for
The tool will prompt you for:
Name of the application as will be shown in
package.json. If the name had been supplied from the command-line, the prompt is skipped and the application is built with the name from the command-line argument. Must follow npm naming conventions.
Description of the application as will be shown in
Name of the directory in which to create your application. Defaults to the name of the application previously entered.
Name of the Application class in
application.ts. Defaults to
Optional modules to add to the application. These modules are helpful tools to help format, test, and build a LoopBack4 application. Defaults to
truefor all of the modules. The prompted modules are:
The core scaffold of a LoopBack4 application generated by the CLI consists of the following files and directories:
. ├── src/ | ├── controllers/ | | └── ping.controller.ts | ├── datasources/ | ├── models/ | ├── repositories/ | ├── application.ts | ├── index.ts | └── sequence.ts ├── test/ └── package.json
ping.controller.ts is a file used to provide the application with a responsive
endpoint. It contains logic to respond with a greeting message when the
application receives a
GET request from endpoint
cd to the application’s newly created directory and run
npm start to see the
application running at
localhost:3000. Go to
localhost:3000/ping to be
greeted with a message.
Once the application has been created, additional generators such as controller generator can be run from the application’s root directory to further scaffold the application.