Sugar-interface to access multiple data sources.
In the example below, we will:
- Create a new instance of Regard ;
- Load two connectors (FsConnector and HttpConnector) ;
- Create two major endpoints (
rootwhich give access to the current folder and
mbwhich give access to the Mockbin API);
- Execute a request to http://mockbin.com/request, write the result into
sample.json, read it and print the content on the standard output.
var Regard = ;// #1 Create a new instance of Regardvar regard = ;// #2 Load two connectorsregard;// #3 Create two major endpointsregard;// #4 Execute a request to;
We can rewrite this example with less code lines:
- Create an instance of Regard initialized with FsConnector and HttpConnector ;
- Create two major endpoints and two nested endpoints (one under the
mbendpoint and an other under the
- Execute a request, write the result into
sample.jsonand print it.
var Regard = ;// #1 Create an instance of Regard initialized with two connectorsvar regard = ;// #2 Create two major endpoints and one nested endpoint under each of themregardmbroot;// #3 Execute a request, write and print the resultregardmb;
The two example above have the same result: the request's response is wrote into
$ cat sample.json