by
Fahmi Abdul Latip
Up and running
What need to be installed
• NodeJS v8.x LTS
• VS Code - https://code.visualstudio.com/
• Insomnia REST client - https://insomnia.rest/
• Loopback CLI
 [sudo] npm install -g loopback-cli@latest
• MySQL Database v5.6 or higher
• HeidiSQL / PHPMyAdmin / Sequel Pro
Loop what? Let’s talk in Express
• The Node.js API Framework.
• One of the framework that based from the
famous web JavaScript framework, ExpressJS.
• Express is a minimal and flexible Node.js web
application framework that provides a robust set
of features for web and mobile applications.
• Comply with Open API specification mostly
• http://nodeframework.com/index.html#rest-api
The Core
Total Framework
Framework Modules
Category Description Use to… Modules
Models Model and API
server
Dynamically mock-up models and expose them
as APIs without worrying about persisting.
loopback
Abstraction Model data
abstraction to
physical
persistence
Connect to multiple data sources or services and
get back an abstracted model with CRUD
capabilities independent of backing data source.
loopback-datasource-juggler
Initialization Application
initialization
Configure data sources, customize models,
configure models and attach them to data
sources; Configure application settings and run
custom boot scripts.
loopback-boot
Sequencing Middleware
execution
Configure middleware to be executed at various
points during application lifecycle.
loopback-phase
Data RDBMS and
noSQL physical
data sources
Enable connections to RDBMS and noSQL data
sources and get back an abstracted model.
•loopback-connector-mongodb
•loopback-connector-mysql
•loopback-connector-
postgresql
•loopback-connector-msssql
•loopback-connector-oracle
•Many others…
Integration General system
connectors
Connect to an existing system that expose APIs
through common enterprise and web interfaces
•loopback-connector-rest
•loopback-connector-soap
Components Add-ons to core
LoopBack
Integrate with pre-built services packaged into
components.
•loopback-component-push
•loopback-component-storage
•loopback-component-passport
Clients Client SDKs Develop client app using native platform objects
(iOS, Android, AngularJS) that interact with
LoopBack APIs via REST.
•loopback-sdk-ios
•loopback-sdk-android
•loopback-sdk-angular
Data Sources and Connectors
Create New “lb app”
__dirname structure
Create Persistence Model
Run the explorer…
http://loopback.io/doc/en/lb3/Use-API-
Explorer.html
Hooking up to real Datasource
Auto-migrate / Auto-update
'use strict';
module.exports = function(app) {
app.dataSources.<ds name>.autoupdate(‘<modelname>’, err => {
if (err) throw err;
});
};
Establishing relationship
• lb relation
 1 to 1
 1 to many
 Many to many
• Through table
User based model
• Build-in model in framework
• Basic authentication, ACL and AccessToken
ready
Access Control List

LoopbackJS the intro

  • 1.
  • 2.
    What need tobe installed • NodeJS v8.x LTS • VS Code - https://code.visualstudio.com/ • Insomnia REST client - https://insomnia.rest/ • Loopback CLI  [sudo] npm install -g loopback-cli@latest • MySQL Database v5.6 or higher • HeidiSQL / PHPMyAdmin / Sequel Pro
  • 3.
    Loop what? Let’stalk in Express • The Node.js API Framework. • One of the framework that based from the famous web JavaScript framework, ExpressJS. • Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. • Comply with Open API specification mostly • http://nodeframework.com/index.html#rest-api
  • 4.
  • 5.
  • 6.
    Framework Modules Category DescriptionUse to… Modules Models Model and API server Dynamically mock-up models and expose them as APIs without worrying about persisting. loopback Abstraction Model data abstraction to physical persistence Connect to multiple data sources or services and get back an abstracted model with CRUD capabilities independent of backing data source. loopback-datasource-juggler Initialization Application initialization Configure data sources, customize models, configure models and attach them to data sources; Configure application settings and run custom boot scripts. loopback-boot Sequencing Middleware execution Configure middleware to be executed at various points during application lifecycle. loopback-phase Data RDBMS and noSQL physical data sources Enable connections to RDBMS and noSQL data sources and get back an abstracted model. •loopback-connector-mongodb •loopback-connector-mysql •loopback-connector- postgresql •loopback-connector-msssql •loopback-connector-oracle •Many others… Integration General system connectors Connect to an existing system that expose APIs through common enterprise and web interfaces •loopback-connector-rest •loopback-connector-soap Components Add-ons to core LoopBack Integrate with pre-built services packaged into components. •loopback-component-push •loopback-component-storage •loopback-component-passport Clients Client SDKs Develop client app using native platform objects (iOS, Android, AngularJS) that interact with LoopBack APIs via REST. •loopback-sdk-ios •loopback-sdk-android •loopback-sdk-angular
  • 7.
    Data Sources andConnectors
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
    Hooking up toreal Datasource
  • 13.
    Auto-migrate / Auto-update 'usestrict'; module.exports = function(app) { app.dataSources.<ds name>.autoupdate(‘<modelname>’, err => { if (err) throw err; }); };
  • 14.
    Establishing relationship • lbrelation  1 to 1  1 to many  Many to many • Through table
  • 15.
    User based model •Build-in model in framework • Basic authentication, ACL and AccessToken ready
  • 16.