Skip to content

Instantly share code, notes, and snippets.

@erhangundogan
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save erhangundogan/a0e6755edf7f05e5d611 to your computer and use it in GitHub Desktop.

Select an option

Save erhangundogan/a0e6755edf7f05e5d611 to your computer and use it in GitHub Desktop.
loopback usage

loopback.io directory structure

  • 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.

/server - Node files

  • server.js: Main application program file.

  • config.json: Application settings.

    app.get('option-name')

  • datasources.json: Data source configuration file.

    app.datasources['datasource-name']

  • model-config.json: Model configuration file. LoopBack applications use the model-config.json file to link models to data sources

  • middleware.json: Middleware definition file.

  • /boot directory: Add scripts to perform initialization and setup. Scripts are automatically executed in alphabetical order.

/client - Client files

/common - Shared file

/models directory:

  • Custom model files: Model definitions, by convention named modelName.json.
  • Custom model scripts by convention named modelName.js.

myModel = app.models.myModelName

Built-in models

Actually, LoopBack creates several other built-in models for common use cases:

  • Application model - contains metadata for a client application that has its own identity and associated configuration with the LoopBack server.
  • User model - register and authenticate users of your app locally or against third-party services.
  • Access control models - ACL, AccessToken, Scope, Role, and * RoleMapping models for controlling access to applications, resources, and methods.
  • Email model - send emails to your app users using SMTP or third-party services.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment