Models

To create a Model click on the model icon on the entity palette:

The Model Entity is a graphical representation of a LoopBack Model. Models can have properties you’d like to expose from data sources and services through Connectors.

If you’re familiar with the Model-View-Controller pattern, Models in Express Serverless Platform are exactly the M in MVC. For folks who are more backend, a model is very much like a data access object.

All Models are Node.js JavaScript functions. Models have the following basic built in functionality:

  • properties
  • read and or write data through Connectors.
  • scaffold a REST representation dynamically based on its definition

Quick Edit a Model

After creating a Model in the private quadrant, you’ll be ready to enter properties with a property name and property type while in Quick Edit mode. To enter quick edit mode for a Model, click the pencil Quick Edit icon on the Model, by hovering over its title bar to display the context menu.

Model Quick Edit Icon

Model Details

Models have advanced functionality that can be access through its Details. To access a Model’s Details, hover over the title bar to display the context menuu and chose the ellipses icon.

Model Details Icon

Models details expose things like relationships, connector metadata, user defined fields, and other advanced functionality.

Model Details

Because Models are really nothing more than JavaScript functions, a code editor is also provided in Model Details to script anything that doesn’t have a GUI representation including custom logic.

Model Code Editor

Express Serverless Platform provides a GUI experience to help you get started and gives you have complete control once you become a more advanced user. For more information on advanced features and customizing Models programatically through code refer to the LoopBack model documentation.

Auto REST Generation

Once a Model is connected to a Connector it will automatically generate a REST interface and corresponding Swagger/OpenAPIv2 specification and with fully functional endpoints.

The REST Generation is not only automatic by dynamically updated as you edit your Model.

Click on the gear icon in the right hand toolbar to actiave the Settings Panel. LBWS urls

Visit the URL listed for the API Explorer to try out the REST API. LBWS urls