Loopback Console
Using the API Explorer
in the browser is all right but if you're looking for something a bit slicker then the loopback-console can be your goto tool.
As of this writing, it is developed and maintained by Heath Morrison, his GitHub handle is doublemarked
and you can reach out to him to express your gratitude if you like, in a gitter.im chat room, if you feel so inclined.
loopback-console
has many advanced uses and it is even used in production alongside deployed loopback solutions for some very clever reasons that I do not fully understand ... so we will stick to one of its simpler uses: command line interface (CLI) for exploring the API.
Lets get cracking:
a) Install it in your loopback project:
b) Set it up for easy access. Update your package.json file. FROM:
TO:
c) Take it for a spin:
c.1) npm run console
c.2) Let's try to list all users: var allUsers = UserModel.find({include:'roles'},cb)
c.3) Results will be something like:
press ctrl+c
once to kill this command so that you may enter the next one.
c.4) To unpack the roles: [ [Object] ]
piece, let's look at a specific result from the array: result[0]
now you can clearly see the roles.
You can let your imagination go wild for all the ways you might use this power, for now we'll just move on.
Last updated