loopback/docs/cli.md

1.7 KiB

Command Line Tool

StrongLoop Suite includes a command-line tool, slc (StrongLoop Command), for working with applications. The slc lb command enables you to quickly create new LoopBack applications and models with the following sub-commands:

  • workspace: create a new workspace, essentially a container for multiple projects.
  • project: create a new application.
  • model: create a new model for a LoopBack application.

For more information on the slc command, see StrongLoop Control.

workspace

slc lb workspace wsname

Creates an empty directory named wsname. The argument is optional; default is "loopback-workspace".

A LoopBack workspace is essentially a container for application projects. It is not required to create an application, but may be helpful for organization.

project

slc lb project app_name

Creates a LoopBack application called appname, where appname is a valid JavaScript identifier. This command creates a new directory called appname in the current directory containing:

  • app.js
  • package.json
  • modules directory, containing:
    • app directory - contains config.json, index.js, and module.json files
  • db directory - contains files index.js and module.json
  • docs directory - contains files config.json, index.js, and module.json; explorer directory

model

slc lb model modelname

Creates a model named modelname in an existing LoopBack application.

Provide the -i or --interactive flag to be prompted through model configuration. Use the --data-source flag to specify the name of a custom data source; default is data source named "db".