This article summarizes LoopBack CLI tool commands.
Page Contents

Two command-line tools are available for Loopback:

  • StrongLoop command-line tools: slc loopback.
  • IBM API Connect developer toolkit CLI: apic loopback.

You use these tools to create and scaffold applications. Scaffolding simply means generating the basic code for your application. You can then extend and modify the code as desired for your specific needs.

The command-line tools provide an Application generator to create a new LoopBack application and a number of sub-generators to scaffold an application, as described in the following table. The commands are listed roughly in the order that you would use them.

Commands

Commands table here.

Commands See Description
slc loopback
apic loopback
Application generator Create a new LoopBack application.
slc loopback:datasource
apic create --type datasource
Data source generator Add a new data source to a LoopBack application.
slc loopback:model
apic create --type model
Model generator Add a new model to a LoopBack application.
slc loopback:property
apic loopback:property
Property generator Add a new property to an existing model.
slc loopback:acl
apic loopback:acl
ACL generator Add a new access control list (ACL) entry to the LoopBack application.
slc loopback:relation
apic loopback:relation
Relation generator Add a new model relationship.
slc loopback:remote-method
apic loopback:remote-method
Remote method generator Add a new remote method..
slc loopback:middleware
apic loopback:middleware
Middleware generator Add a new middleware configuration.
slc loopback:boot-script
apic loopback:boot-script
Boot script generator Add a new boot scripts.
slc loopback:export-api-def
apic loopback:export-api-def
API definition generator Export Swagger API definition.
slc loopback:swagger
apic loopback:swagger
Swagger generator Generates a fully-functional application that provides APIs conforming to the Swagger 2.0 specification.
apic loopback:refresh   Generate a product and an OpenAPI (Swagger) definition

Using Yeoman

Under the hood, the command-line tools use Yeoman. If you are already using Yeoman and are comfortable with it, you can install the LoopBack generator directly with the command:

$ npm install -g generator-loopback.

Then instead of using slc loopback:<command> use yo loopback:<command> instead. For example, to create a new model, use yo loopback:model.