Data sources contain the actual data behind models and provide a way to persist the data. Models attached to persistent data sources get additional methods for create, read, update, and delete (CRUD) operations. For more information, see Connecting models to data sources.
Install the data source connector
By default, LoopBack models use the built-in memory connector for development and testing. LoopBack applications created with
slc loopback include the memory data source and connector. The memory connector's data persists only while your LoopBack application is running: all data is lost when the LoopBack application is stopped. The In-memory data source is named "db" by default and is shown in the navigation pane under the Data Sources folder.
See Connecting models to data sources for a complete list of connector modules.
Creating a new data source
Before creating a new data source you must install the corresponding connector as described above.
To create a new data source:
- Click + Add New Data source in the navigation pane.
- Click for the desired database type under DATASOURCE in the toolbox palette.
Editing a data source
To edit an existing data source, simply click on it in the Data sources folder of the navigation pane. The data source editor opens.
You can edit several data sources at the same time, since each opens in a separate tab.
To delete a datasource, click then choose delete. This deletes the data source entry in
When you create a new data source or edit an existing data source as described above, you'll see the data source editor.