Post on 14-Apr-2017
Rapid API Development with LoopBack/StrongLoop
Raymond Camden
Rabid API Development
Who am I?
Developer Advocate for IBM
StrongLoop, Bluemix, Cordova/PhoneGap, Node, and web stuff in general
Blogging at raymondcamden.com
Tweeting at @raymondcamden
https://unsplash.com/pjrvs
How I did web sites (old days)
How I did web sites (old days)Focused heavily on an app server
How I did web sites (old days)Focused heavily on an app server
App server did everything (database access, generating HTML, etc)
How I did web sites (old days)Focused heavily on an app server
App server did everything (database access, generating HTML, etc)
Client-side was really limited
How I did web sites (old days)Focused heavily on an app server
App server did everything (database access, generating HTML, etc)
Client-side was really limited
Ex:
How I did web sites (old days)Focused heavily on an app server
App server did everything (database access, generating HTML, etc)
Client-side was really limited
Ex:
Client: "I need a list of cats"
How I did web sites (old days)Focused heavily on an app server
App server did everything (database access, generating HTML, etc)
Client-side was really limited
Ex:
Client: "I need a list of cats"
Server: "I'll ask the database for the list."
How I did web sites (old days)Focused heavily on an app server
App server did everything (database access, generating HTML, etc)
Client-side was really limited
Ex:
Client: "I need a list of cats"
Server: "I'll ask the database for the list."
Server: "I'll take that list and generate a lot of HTML to render it"
How I did web sites (old days)Focused heavily on an app server
App server did everything (database access, generating HTML, etc)
Client-side was really limited
Ex:
Client: "I need a list of cats"
Server: "I'll ask the database for the list."
Server: "I'll take that list and generate a lot of HTML to render it"
Server: "I'll wrap that display in some site template with dynamic junk"
How I did web sites (old days)Focused heavily on an app server
App server did everything (database access, generating HTML, etc)
Client-side was really limited
Ex:
Client: "I need a list of cats"
Server: "I'll ask the database for the list."
Server: "I'll take that list and generate a lot of HTML to render it"
Server: "I'll wrap that display in some site template with dynamic junk"
Server: "I'll return a big pile of HTML to you"
How I did web sites (old days)Focused heavily on an app server
App server did everything (database access, generating HTML, etc)
Client-side was really limited
Ex:
Client: "I need a list of cats"
Server: "I'll ask the database for the list."
Server: "I'll take that list and generate a lot of HTML to render it"
Server: "I'll wrap that display in some site template with dynamic junk"
Server: "I'll return a big pile of HTML to you"
How I do web sites now...
How I do web sites now...The client doesn't suck anymore!
How I do web sites now...The client doesn't suck anymore!
Mobile is everywhere - apps, apps, and more apps!
How I do web sites now...The client doesn't suck anymore!
Mobile is everywhere - apps, apps, and more apps!
My server just responds to API calls
How I do web sites now...The client doesn't suck anymore!
Mobile is everywhere - apps, apps, and more apps!
My server just responds to API calls
Ex:
How I do web sites now...The client doesn't suck anymore!
Mobile is everywhere - apps, apps, and more apps!
My server just responds to API calls
Ex:
Client: "Give me a list of cats"
How I do web sites now...The client doesn't suck anymore!
Mobile is everywhere - apps, apps, and more apps!
My server just responds to API calls
Ex:
Client: "Give me a list of cats"
Server: "Here is a list in raw JSON"
How I do web sites now...The client doesn't suck anymore!
Mobile is everywhere - apps, apps, and more apps!
My server just responds to API calls
Ex:
Client: "Give me a list of cats"
Server: "Here is a list in raw JSON"
Client: "Thanks, you're awesome, I'll render it"
How I do web sites now...The client doesn't suck anymore!
Mobile is everywhere - apps, apps, and more apps!
My server just responds to API calls
Ex:
Client: "Give me a list of cats"
Server: "Here is a list in raw JSON"
Client: "Thanks, you're awesome, I'll render it"
The Server in 2016
The Server in 2016
Smaller
The Server in 2016
Smaller
Simpler
The Server in 2016
Smaller
Simpler
Just an API provider
The Server in 2016
Smaller
Simpler
Just an API provider
Not some big machine I rent
"Typical" Setup (Then)
Apache
Adobe ColdFusion
MySQL
Minimal JavaScript on the client
"Typical" Setup (Now)
Node.js
Express
Cloudant/MongoDB/etc
JavaScript on the server, client, cloud, breakfast, etc
A confession...
Credit: https://flic.kr/p/9wXA3J
Express
Express
No boilerplate web server crap
Express
No boilerplate web server crap
Focused on rapidly building a web site/app
LoopBack
LoopBackOpen source framework designed for APIs
http://loopback.io
LoopBackOpen source framework designed for APIs
Rapid creation of Models and REST APIs
http://loopback.io
LoopBackOpen source framework designed for APIs
Rapid creation of Models and REST APIs
Simple ORM system for CRUD
http://loopback.io
LoopBackOpen source framework designed for APIs
Rapid creation of Models and REST APIs
Simple ORM system for CRUD
Support for JavaScript apps (Angular)
http://loopback.io
LoopBackOpen source framework designed for APIs
Rapid creation of Models and REST APIs
Simple ORM system for CRUD
Support for JavaScript apps (Angular)
Very detailed/configurable security policies
http://loopback.io
LoopBackOpen source framework designed for APIs
Rapid creation of Models and REST APIs
Simple ORM system for CRUD
Support for JavaScript apps (Angular)
Very detailed/configurable security policies
loopback.io
http://loopback.io
StrongLoop
StrongLoopGraphical tool for working with LoopBack
StrongLoopGraphical tool for working with LoopBack
Deployment
StrongLoopGraphical tool for working with LoopBack
Deployment
Management
StrongLoopGraphical tool for working with LoopBack
Deployment
Management
Monitoring
StrongLoopGraphical tool for working with LoopBack
Deployment
Management
Monitoring
Debugging
StrongLoopGraphical tool for working with LoopBack
Deployment
Management
Monitoring
Debugging
strongloop.com
Getting Started
Installation
Requires npm (Node Package Manager)
Install Node.js (nodejs.org)
npm install g strongloop
CLI: slc
Creating an Application
Creating an Application
slc loopback
Creating an Application
slc loopback
Follow the prompts
Creating an Application
slc loopback
Follow the prompts
Define models
Creating an Application
slc loopback
Follow the prompts
Define models
Run the application
Enter the StrongLoop
Enter the StrongLoop
Runs on top of LoopBack
Enter the StrongLoop
Runs on top of LoopBack
Does a heck of a lot more than I'm showing today
Enter the StrongLoop
Runs on top of LoopBack
Does a heck of a lot more than I'm showing today
To be clear - this is optional
Bobby Tables
I should just put a cat picture here.
Then what?
Then what?Setup a datasource
Then what?Setup a datasource
Cloudant, DB2, Memory, MongoDB, MySQL, Oracle, PostgreSQL, Redis, SQL Server
Then what?Setup a datasource
Cloudant, DB2, Memory, MongoDB, MySQL, Oracle, PostgreSQL, Redis, SQL Server
npm install loopback-connector-mongodb --save
Then what?Setup a datasource
Cloudant, DB2, Memory, MongoDB, MySQL, Oracle, PostgreSQL, Redis, SQL Server
npm install loopback-connector-mongodb --save
Setup security
Then what?Setup a datasource
Cloudant, DB2, Memory, MongoDB, MySQL, Oracle, PostgreSQL, Redis, SQL Server
npm install loopback-connector-mongodb --save
Setup security
Add custom methods
Then what?Setup a datasource
Cloudant, DB2, Memory, MongoDB, MySQL, Oracle, PostgreSQL, Redis, SQL Server
npm install loopback-connector-mongodb --save
Setup security
Add custom methods
Unique stuff (/api/Cats?filter[where][friendly]=true vs /friendlyCats)
Then what?Setup a datasource
Cloudant, DB2, Memory, MongoDB, MySQL, Oracle, PostgreSQL, Redis, SQL Server
npm install loopback-connector-mongodb --save
Setup security
Add custom methods
Unique stuff (/api/Cats?filter[where][friendly]=true vs /friendlyCats)
Customize how data is stored ("If friendly, change name to")
Then what?Setup a datasource
Cloudant, DB2, Memory, MongoDB, MySQL, Oracle, PostgreSQL, Redis, SQL Server
npm install loopback-connector-mongodb --save
Setup security
Add custom methods
Unique stuff (/api/Cats?filter[where][friendly]=true vs /friendlyCats)
Customize how data is stored ("If friendly, change name to")
Build your client
Bobby Tables
I bet I could find a meme pic for this slide.
Stuff I didn't cover
Stuff I didn't cover
Customize the heck out of it
Stuff I didn't cover
Customize the heck out of it
File support
Stuff I didn't cover
Customize the heck out of it
File support
Totally custom storage
Stuff I didn't cover
Customize the heck out of it
File support
Totally custom storage
API-based model
Stuff I didn't cover
Customize the heck out of it
File support
Totally custom storage
API-based model
All the performance/deployment/scaling/etc
More stuff I didn't cover
More stuff I didn't cover
API Connect
More stuff I didn't cover
API Connect
Node or Java
More stuff I didn't cover
API Connect
Node or Java
API Creation, Management, Security, etc
More stuff I didn't cover
API Connect
Node or Java
API Creation, Management, Security, etc
Available March 15
Wrap up
Zero to API in less than 5 minutes
REST compliant - if you hate the prototype, you can rebuild
https://docs.strongloop.com
Any questions?
You can email here: raymondcamden@gmail.com
You can follow me here: @raymondcamden (all serious stuff, no cat pics, honest)
You can read my stuff here: www.raymondcamden.com (I won't lie - there's a few cat pics here)