Loopback: A weapon of back-end pirates, RESTFULL-y

Photo by Alonso Reyes on Unsplash

Why loopback (in pirates style)?

What is loopback?

How loopback! Setup your project

npm install -g  loopback-cli
lb
Project name: (for default just press enter)
choose your loopback version: choose 3.x
choose your project type: choose empty-project
npm i loopback-connector-mongodb --save 
node .

How loopback! Start development

lb datasource
Enter the datasource name: main-db
? Select the connector for main-db: MongoDB (supported by StrongLoop)
? Connection String url to override other settings (eg: mongodb://username:password@hostname:po
rt/database): mongodb://127.0.0.1:27017
? host:
? port:
? user:
? password: [hidden]
? database: hello-app-db
? Feature supported by MongoDB v3.1.0 and above: Yes
lb model
? Enter the model name: greeting
? Select the datasource to attach greeting to: db (mongodb)
? Select model's base class PersistedModel
? Expose greeting via the REST API? Yes
? Custom plural form (used to build REST URL):
? Common model or server only? server
? Enter the property name: message
? Property type: string
? Required? Yes
? Default value[leave blank for none]: "Hello from other side"
Let's add another greeting property.
Enter an empty property name when done.
? Enter the property name: greeter
? Property type: string
? Required? Yes
? Default value[leave blank for none]:
Let's add another greeting property.
Enter an empty property name when done.
? Enter the property name:
lb relation // to create relation between models
lb property // to add property to a model
lb acl // Add user autentication
node .
http://localhost:3000/explorer

Why not loopback!

At the End!