Page Contents

Synopsis

Adds a new data source definition to a LoopBack application.

lb datasource [options] [<name>]

With IBM API Connect developer toolkit:

apic create --type datasource [options] --name [<name>]

With legacy StrongLoop tools:

slc loopback:datasource [options] [<name>]

Options

--bluemix
Fetch provisioned data source services from IBM Cloud and present them in the list of choices for data source to add. Currently lists only Cloudant, MongoDB, and IBM Object Storage services. You will be prompted to log in if you are not already authenticated.
-n, --name
With IBM API Connect developer toolkit only, optionally provide the name of the data source as the value of this option.  If provided, the tool will use that as the default when it prompts for the name.

標準オプション

-h, --help
ツールのオプションと使い方を表示します。
--skip-cache
質問の回答を記憶しません。既定値は false です。
--skip-install
依存関係を自動的にインストールしません。既定値は false です。

Arguments

You can optionally provide the name of the data source to create as an argument.  If you do, 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 new data source. If you supplied a name on the command-line, just hit Enter to use it.
  • Connector to use for the data source. If you run the generator with the --bluemix option, you will be presented with a list of provisioned data services from IBM Cloud.

You must install the connector for the new data source; for example: npm install --save loopback-connector-mysql

Output

This adds an entry to datasources.json with the specified settings.

If you selected a IBM Cloud data source, it will be entered in the .bluemix/datasources-config.json file.