Page Contents

LoopBack project files and directories are in the application root directory. Within this directory the standard LoopBack project structure has three sub-directories:

  • server - Node application scripts and configuration files.
  • client - Client JavaScript, HTML, and CSS files.
  • common - Files common to client and server. The /models sub-directory contains all model JSON and JavaScript files.
  • definitions - API and product definition YAML files (IBM API Connect only).
File or directory Description How to access in code
Top-level application directory
/node-modules directory Contains Node packages as specified as dependencies in package.json. Update with npm install. N/A

Standard npm package specification. See package.json.

N/A
README.md Stub file for internal documentation. N/A
/server directory - Node application files
/boot directory Add scripts to perform initialization and setup. See boot scripts. Scripts are automatically executed in alphabetical order.
component-config.json Specifies LoopBack components to load. Created by Strongloop tools only. Not used in API Connect.
config.json Application settings. See config.json. app.get('setting-name')
datasources.json Data source configuration file. See datasources.json. For an example, see Create new data source. app.datasources['datasource-name']
middleware.json Middleware definition file. For more information, see Defining middleware. N/A
middleware.production.json Middleware definition file with production configuration. See Preparing for deployment.  
model-config.json Model configuration file. See model-config.json. For more information, see Connecting models to data sources. N/A
server.js Main application program file.  N/A
/client directory - Client application files
README.md LoopBack generators create empty README.md file. N/A
Other Add your HTML, CSS, client JavaScript files.  
/common directory - shared application files
/models directory

Custom model files:

  • Model definition JSON files, by convention named model-name.json; for example customer.json.
  • Custom model scripts by convention named model-name.js; for example, customer.js.

For more information, see Model definition JSON file and Customizing models.  See note below.

Node:
myModel = app.models.myModelName