API – Node.js, Loopback

I come from a background of data analytics where I spend most of my time in the SQL world. Playing directly against the backend tables is fast and easy. However, assuming you or your analytics are the only users of the data, it really doesn’t matter which particular tool you use and once you are comfortable and you boss is ok with the productivity, that is it. However, if there is something that has a decent size of user groups, you might want to consider building a service on top of it, in this case, we use API to make it friendly to the developer and next, some developers can build a web page on top of it and it is friendly to the whole world. 🙂

I came across a fantastic framework while researching about different options to build an API, at least, when I type in “API” and specify the language by node.js into Google, that is the top 1 search result.

Following the “Get Started” tutorial, one can first install node.js and loopback in a few minutes, copy paste the tutorial and you can probably get up and running in less than 10 minutes.


As you can see, I created the “model” people and specify a property firstname to get started. Loopback “automagically” created 13 operations so one can manipulate the data source like a boss – “CRUD” (create, read, update and delete).

The feature that I like a lot is that you can play with all the API operations interactively in the API explorer. You can expand the operation you like and type in the data part at your will and it will just work! or not, if you did n’t follow the right format.

explorerHere is a link to a documentation where all the operations, in this case, all the ones related to persistedmodel REST API are here. That will help you a lot if you think the limited information in the explorer is not good enough to get you started.

Here is a screenshot of how I “insert” three people instances into the database. As you can see, the explorer really did a good job giving your everything you need to write, debug and run a API call. They even give you the curl command so you can easily reproduce the same operation in your command line using curl.

There is also a fantastic tool called Arc where you have can did what I just did by Clicking buttons if you think GUI will make you a little more comfortable. You can take a brief look by visiting the get started page here.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s