Skip to content

Instantly share code, notes, and snippets.

@dearfrankg
Last active September 8, 2016 23:22
Show Gist options
  • Select an option

  • Save dearfrankg/357b588ed5d930110e484f5b449d0a1e to your computer and use it in GitHub Desktop.

Select an option

Save dearfrankg/357b588ed5d930110e484f5b449d0a1e to your computer and use it in GitHub Desktop.
loopback-getting-started process
// loopback-getting-started abbreviated process
// install loopback
npm install -g strongloop
// generate app
slc loopback CoffeeShops
? What's the name of your application? CoffeeShops
? Enter name of the directory to contain the project: CoffeeShops
? Which version of LoopBack would you like to use? 2.x (stable)
? What kind of application do you have in mind? api-server (A LoopBack API server with local User auth)
// goto project directory
cd CoffeeShops
// add data source (mongoDB)
slc loopback:datasource
[?] Enter the data-source name: dsMongoDB
[?] Select the connector for mysqlDS: (Use arrow keys) -- select MongoDB
// generate model (CoffeeShop)
slc loopback:model
Model name: CoffeeShops
Data source: mongoDs (mongodb)
Base class: Use the down-arrow key to select PersistedModel.
Expose Reviewer via the REST API? Press RETURN
Custom plural form (used to build REST URL): Press RETURN
Common model or server only: Press RETURN
propName propType Required? default
---------------------------------------------
name string y none
city string y none
// create sample data (see https://goo.gl/2aB4lE)
create /server/boot/create-sample-models.js
// start the app
node .
// test api explorer
open localhost:3000/explorer // create, read, update, delete, etc.
// test database
mongodb-client // confirm database and data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment